UPDATE
So I have a bit of a problem. I have an app that uses Location and I have made it to set the permission.
One of the problem is that I need to restart the application to make it take effect and thats not so good.
Here is how I have done with the asking permission for location permission to get turned on:
private void enableMyLocation() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
// Permission to access the location is missing.
PermissionUtils.requestPermission(this, LOCATION_PERMISSION_REQUEST_CODE,
Manifest.permission.ACCESS_FINE_LOCATION, true);
} else if (mMap != null) {
// Access to the location has been granted to the app.
mMap.setMyLocationEnabled(true);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,@NonNull int[] grantResults) {
if (requestCode != LOCATION_PERMISSION_REQUEST_CODE) {
return;
}
if (PermissionUtils.isPermissionGranted(permissions, grantResults, Manifest.permission.ACCESS_FINE_LOCATION)) {}
else{
mPermissionDenied = true;
}
}
I am getting a wierd Dialogbox that says "ABC" as title and then have "Cancel" and "Ok" buttons. Here is a link of how it looks. Also the map does not load until restart of application.