grgp89
Lurker
Hello guys!
I have the following code to request location update, but it doesn't work. I get this error "Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException".
Can you help me with some answers?
Thank you a lot!
The code that I have:
if (mLocationManager.getAllProviders().indexOf(LocationManager.GPS_PROVIDER) >= 0) {
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 0, this);
} else {
Log.w("MainActivity", "No GPS location provider found. GPS data display will not be available.");
}
if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
showGpsDisabledDialog();
}
mLocationManager.addGpsStatusListener(this);
PS: I included user-permission in AndroidManifest. I am running sdkVersion 27
I have the following code to request location update, but it doesn't work. I get this error "Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException".
Can you help me with some answers?
Thank you a lot!
The code that I have:
if (mLocationManager.getAllProviders().indexOf(LocationManager.GPS_PROVIDER) >= 0) {
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 0, this);
} else {
Log.w("MainActivity", "No GPS location provider found. GPS data display will not be available.");
}
if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
showGpsDisabledDialog();
}
mLocationManager.addGpsStatusListener(this);
PS: I included user-permission in AndroidManifest. I am running sdkVersion 27