I have simple code that wants to read the state of network connection. I've added permission to the AndroidManifest.xml:
<user-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
My code that tries to access network state:
ConnectivityManager conmgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ninfo = conmgr.getActiveNetworkInfo();
And the error that is thrown:
E/AndroidRuntime(7650): java.lang.SecurityException: ConnectivityService: Neither user 10080 nor current process has android.permission.ACCESS_NETWORK_STATE.
I've long tried to find any error, but everything seems to be spelled correctly. It seems like the new version of AndroidManifest is not deployed to device. I've tried to clean project in Eclipse, uninstall app from phone, but nothing is working, I get the same communicate again. What I'm doing wrong?
I think it is
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
instead of
<user-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With