@d_Taraoa: I would be interested in seeing how this app performs for you. I tested it on a Pixel 3 running Android 12 and was able to get an accuracy as low as 4.288 m depending on my distance from nearby buildings. The Pixel 3 in question did not have a SIM card nor was it connected to Wifi, so the results should have been coming from the GPS alone.
I have modified LocationSensorTest with the FineLocation permission, I have no error during the installation and everything is OK
the Accuracy is 3 or 4 m
it is better that locationSensor is disabled in designer (I don't understand why) and to activate it in the initialization of the screen only
The GPS icon is in the status bar
and everything is correct.
I will modify my other applications and I will keep you informed
thank you so much
Yes, but not only on Android 12. I get the same error on Android 11 and 12 (Companion). (But both permissions are declared in the Manifest of the Companion app.)
Hello
I did some tests on this rainy Sunday
the finelocation permission works if: LocationSensor is disabled in designer The permission request must not be in the initialization of the screen (otherwise I get a temporary permission, if I close the application the permission is lost)
I use a timer to ask for permission after initialization
we can also use a button
I tested with android 12 and android 8 it's ok
Some details:
TimeInterval is at least 5 seconds (battery protection?)
I have an empty list in the suppliers
the status changed function does not return any results
Has you tested to asign the ProviderName = "gps" and nothing more (lets ProviderLocked = false)?. In this case you don't need to ask and manage the Fine-Permission. In my case it runs well with Android 12.
My LG G8 thinkQ just updated its OS to Android 12 then GPS on my app showed weird output. Now I have to start fixing this problem while I'm not sure where to begin. I just share a screenshot how this problem serious. Now just let you know, GPS works well on my app before Android 12 update.
What is weird Bob? It is impossible to tell from the image you posted. Please explain.
you might post an aia or your Blocks. Impossible to provide advice without sharing code.
Do you have a screen image prior to upgrading to Android 12 to share?
Black line in a screenshot is a route my bicycle moved. I just rode straight from bottom end point of line to north but output line drew weirdly while riding. and I read some comment of getting the ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions in a single runtime request. I don't understand 'a single runtime request'. I assume that means like add two blocks of 'call screen1.AskForPermission permissionName: Permission FineLocaiton' and 'call ... Permission CoarseLocaiton' block. Maybe I'm wrong... riderLang_copy.aia (6.0 MB)
I can start a 'ride' on my Android 8.1 but can't figure out how to display the map. Do I have to wait until the app passes a certain distance threshold.
On Android 12 (API level 31) or higher, users can request that your app retrieve only approximate location information, even when your app requests the ACCESS_FINE_LOCATION runtime permission.
To handle this potential user behavior, don't request the ACCESS_FINE_LOCATION permission by itself. Instead, request both the ACCESS_FINE_LOCATION permission and the ACCESS_COARSE_LOCATION permission in a single runtime request. If you try to request only ACCESS_FINE_LOCATION , the system ignores the request on some releases of Android 12. If your app targets Android 12 or higher, the system logs the following error message in Logcat:
ACCESS_FINE_LOCATION must be requested with ACCESS_COARSE_LOCATION.
it looks like the MIT App Inventor team @ewpatton will have to provide a solution, so both permissions can be requested in a single runtime event… alternatively someone could write a short extension for that…
Interesting that this seems to be applied to all apps regardless of the target SDK version. Typically, if an app targets an earlier version of Android, the semantics for that version are applied. Google Play requires starting today that new apps target Android 12, and in November the same for updated apps, but that's a policy rule enforced by the store and shouldn't affect apps installed directly to the device otherwise. The COARSE/FINE permission change will be in the 2.65 companion update later this month to address Android 12 compatibility. In the meantime, you can try loading the companion from the ai2-test server and see if your LocationSensor behaves correctly since that server includes the pending changes for Android 12.
Added two AskForPermission doesn't work but, the aia code @d_Taraoa posted works. So I attached some steps from this code to mine then GPS went to be as normal.
AskForPermission moved to Clock from Screen1.initialize
Add LocationSensor1.ProviderLocked to true, LocationSensor1.ProviderName to gps in the Screen1.PermissionGranted block.