rommansabbir / NetworkX

πŸ…½πŸ…΄πŸ†ƒπŸ††πŸ…ΎπŸ†πŸ…ΊπŸ†‡ An easy & handy library to monitor device internet connection status.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ConnectivityService: Neither user 11135 nor current process has android.permission.ACCESS_NETWORK_STATE

Mohammad-Adam opened this issue Β· comments

this happend once suddenly, don't know why! :(
and I have this permission in Manifest

stacktrace

E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-7
    Process: com.******, PID: 15086
    java.lang.SecurityException: ConnectivityService: Neither user 11135 nor current process has android.permission.ACCESS_NETWORK_STATE.
        at android.os.Parcel.createException(Parcel.java:1950)
        at android.os.Parcel.readException(Parcel.java:1918)
        at android.os.Parcel.readException(Parcel.java:1868)
        at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:1199)
        at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:883)
        at com.rommansabbir.networkx.NetworkX.isNetworkAvailable(NetworkX.kt:180)
        at com.rommansabbir.networkx.NetworkX.startObserving(NetworkX.kt:144)
        at com.rommansabbir.networkx.NetworkX.startObserving(NetworkX.kt:154)
        at com.rommansabbir.networkx.NetworkX$startObserving$1.invokeSuspend(Unknown Source:12)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
     Caused by: android.os.RemoteException: Remote stack trace:
        at android.app.ContextImpl.enforce(ContextImpl.java:1812)
        at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1840)
        at com.android.server.ConnectivityService.enforceAccessPermission(ConnectivityService.java:1683)
        at com.android.server.ConnectivityService.getActiveNetworkInfo(ConnectivityService.java:1192)
        at android.net.IConnectivityManager$Stub.onTransact(IConnectivityManager.java:85)

Try rebuilding your project (clean, build). or
<uses-permission android:name="android.permission.INTERNET" />
add this permission to your app manifest.