Android ConnectivityManager does not see ACCESS_NETWORK_STATE permission

I have a simple code that wants to read the status of a network connection. I added permission to AndroidManifest.xml:

<user-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

My code that is trying to access the network state:

  ConnectivityManager conmgr = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ninfo = conmgr.getActiveNetworkInfo(); 

And the error that is being called:

  E/AndroidRuntime(7650): java.lang.SecurityException: ConnectivityService: Neither user 10080 nor current process has android.permission.ACCESS_NETWORK_STATE. 

I have long been trying to find some kind of error, but everything seems to be spelled correctly. It appears that the new version of AndroidManifest is not being used on the device. I tried to clear the project in Eclipse, uninstall the application from the phone, but nothing works, I get the same message again. What am I doing wrong?

+8
android eclipse android-networking eclipse-adt
source share
1 answer

I think that it's

 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

instead

 <user-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
+20
source share

All Articles