GPS authorization for app

Hi, i created my app that uses gps.
On my android 9 when i install and launch the app it asks me if i want to authorize my mobile to the usage of gps, great.
On android 10 or sup, happends that when i install the app it asks me to authorize the gps only when the app is in use... and not forever...
Where is the problem? In the app blocks or in the mobile settiings?
Thanks for your help

What is the problem? You are authorising when the app is in use.....

no, my app will geolocalizate me also when the app is in background...

Is the app "not in use" when in the background ?

no... the app contains a foreground localization via extension.

problem is when i use android 10... after the installation i found the request as:

  • "authorize GPS only when the app is in use"
  • "don't authorize"

on other applications i found:

  • "authorize GPS only when the app is in use"
  • "authorize GPS only forever"
  • "don't authorize"

is this a publicly available extension? if yes, any link?

see here Request location permissions  |  Sensors and location  |  Android Developers

On Android 10 (API level 29) and higher, you must declare the ACCESS_BACKGROUND_LOCATION permission in your app's manifest in order to request background location access at runtime. On earlier versions of Android, when your app receives foreground location access, it automatically receives background location access as well.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

i edited xml by adding:

  <!-- To request foreground location access, declare one of these permissions. -->
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

and

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

then i recompiled apk but nothing changes.

you forgot to answer this question

which Android version are you using for your tests?
see again the documentation

When a feature in your app requests background location on a device that runs Android 10 (API level 29), the system permissions dialog includes an option named Allow all the time . If the user selects this option, the feature in your app gains background location access.

Taifun