cordova-plugin-android-permissions icon indicating copy to clipboard operation
cordova-plugin-android-permissions copied to clipboard

Background Location permission issue

Open ivinantony opened this issue 2 years ago • 5 comments

when i request for the location permission it doesn’t show allow all the time in the popup. i have already added ACCESS_BACKGROUND_LOCATION in the manifest.

ivinantony avatar May 12 '22 10:05 ivinantony

On which version of Android are you testing? You have to get this permission from app settings since Android 11.

See the docs

zdevaty avatar Jun 28 '22 07:06 zdevaty

Do you have any idea to open the permission settings instead of app settings using this plugin??

ivinantony avatar Jul 06 '22 14:07 ivinantony

Try this:

permissions.requestPermission(permissions.ACCESS_BACKGROUND_LOCATION, success, error);

function error() {
  console.warn('ACCESS_BACKGROUND_LOCATION permission is not turned on');
}

function success( status ) {
  if( !status.hasPermission ) error();
}

zdevaty avatar Jul 07 '22 14:07 zdevaty

@zdevaty Why when i run the code you quoted it just returns ACCESS_BACKGROUND_LOCATION permission is not turned on? It does this to every single one of my request for permissions...

clarklight avatar Jun 06 '23 07:06 clarklight

Maybe this permission is rejected permanently in Android settings somehow?

I don't know and I can't help you, as I changed my career so I won't have to deal with Android background location problems ever again.

zdevaty avatar Jun 06 '23 12:06 zdevaty