Error 908 ACCESS_FINE_LOCATION appears continously at init

Hello.
I've created a small app to get the latitude and longitude coordinates of a point for a trip.

The user can get them in various ways:

  • They can get the coordinates corresponding to their current location,
  • Or by typing an address,
  • Or by moving a map until the desired point is in the center.

Everything works perfectly, except that when prompted the user doesn't grant the app permission to access their detailed location.
In that case, the app upon launch repeatedly displays “Error 908: The permission ACCESS_FINE_LOCATION has been denied. Please enable it in the Setting app”, until (with some difficulty) the app can be closed.
Now there's no way to fix it, unless the user knows how to clear the app's storage data (so it requests permission again upon launch), or the user knows how to go into the app's settings and grant the permission manually.

Does anybody know if is there any way to make for the app to prompt the user again, or at least that the error 908 occurs only once per launch?

That’s the app.

Mapa168(1).aia (7.9 KB)

Does the device have Location set to ON ? Once this is in place FINE_LOCATION should be grantable.

Yes. The device has location set to on.
It seems to be another way to manually grant the permission, By looking for the specific app in the Location menu.

I do not see you requesting FineLocation in your blocks (Screen.Initialise or anywhere else) ?

Here is how I do it, without issue:

1 Like

Thanks a lot. I’ll try.

I believe that setting LocationSensor .enabled to true is what makes the app to promp the user to give permission, but only the first time it launches the app.

I just discovered that exists a when Screen1 .PermissionDenied block.
Perhaps I could use it to check if the user didn’t grant the FINE_LOCATION one, and request it again before giving the user accees to this part of the funcionality of the app.

1 Like

If Location Sensor is enabled in the Designer, permission is requested automatically, but without triggering the PermissionGranted and PermissionDenied events. Therefore, you should disable it in the Designer, enable it in the Screen.Initialize event, and request permission manually there.

We discussed this topic/problem many years ago (probably in the old AI2 forum).

2 Likes
1 Like

We are so lucky to have your expertise!
Thank you so much.

1 Like

Problem solved? If so, close the topic.

I’m still working in minor issues.
But following your suggestion, this worked for me, to end the error appearing continously at start.

By the way.
The problem for the error appearing continously seems to be the Function: RefreshProvider.
I also tried to lock the provider to gps with this blocks, but it didn’t work to stop the error appearing continously.

Am I getting something wrong?

Which error? Post a screenshot.
(Android version, device name, Companion/APK?)

My devices are a cuople of Xiaomi (Redmi 14C and A5), with Android 15.
I’m using the APK file.

Once I began to capture the error (with the when Screen1 .PermissionDenied block and the notifier) and disable the LocationSensor, this message is shown only once, instead of the Error 908 many times at start.

It gives more info than the original error

Of course, they only happen if the app user denied to grant the permission (when they were prompted the first time they opened the app).

You should actually be able to catch that via the Denied event. Show all relevant blocks.

You should request permission again via the Notifier in the Denied event.

Sorry.
That was my fault.
I should only enable LocationSensor, after checking that permission was granted (not at .Initialize).

In both, but in Screen initialize event only if permission granted. The last version of my GetASD extension has this method (isPermissionGranted).

1 Like