0

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.

codemoonger
  • 613
  • 3
  • 11
  • 22
  • After your app calling requestPermissions(for location) and accepting the dialog, means your app is granted to use location. Could you make a bit clear more ? – blackkara Jun 08 '16 at 22:04
  • @Blackkara here is a [link](https://youtu.be/sVDRzpiRPyg) of how the application behave. The biggest problem is that my map is not loading. Now I must shut down the app and start it again to get the map loaded. So big problems – codemoonger Jun 09 '16 at 09:37
  • Try this it may be work http://stackoverflow.com/a/41221852/5488468 – Bipin Bharti Jan 03 '17 at 10:55

0 Answers0