Question Detail

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.tech.scar, PID: 30698
    java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.
        at android.os.Parcel.readException(Parcel.java:1942)
        at android.os.Parcel.readException(Parcel.java:1888)
        at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:732)
        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:914)
        at android.location.LocationManager.requestLocationUpdates(LocationManager.java:472)
        at com.tech.scar.MyService.location(MyService.java:64)
        at com.tech.scar.MyService$1.run(MyService.java:44)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6798)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
06-18 16:04:08.589 30698-30698/com.tech.scar D/OSTracker: OS Event: crash


Thread Reply

VKY

- 5 months ago

you are missing "GPS" location provider requires ACCESS_FINE_LOCATION permission may be in the Manifest file and for above lollipop Android Version, it required on Runtime permission 

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

 

ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);

Anonymous

- 5 months ago

void locationPermission() {
    if (ActivityCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(mActivity, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 1);
    }