Java.lang.SecurityException: ConnectivityService: neither user 10134 nor the current process has android.permission.ACCESS_NETWORK_STATE

I received a report on this exception from 1 user, although I have permission in the manifest

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
+8
android
source share
4 answers

I had this problem too ... when creating against an earlier API, I just got an unhandledException that I noticed when going through getAllNetworkInfo() or getActiveNetworkInfo() . However, nothing was shown in logcat. When creating against the latest API (22), I got the above SecurityException .

For me, the solution turned out to be that I wrote

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

when i needed

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

So, for any developer experiencing this problem and scratching his head, note that these permission names are case sensitive!

+20
source share

I decided to move use-permissions just below the manifest tag

+1
source share

Your rights are correct, check the Null Condition for NetwrokInfo . An object may be a trick that causes a crash. (for those who may run into this problem)

0
source share

Give this permission

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

instead

 <uses-permission android:name="android.Manifest.permission.ACCESS_NETWORK_STATE" /> 
0
source share

All Articles