Android Question Get LocationSettingsRequestBuilder in Android 12

netsistemas

Active Member
Licensed User
Longtime User
My app check if are allowed location.

one part of code are:


B4X:
Sub CheckLocationSettingStatus As ResumableSub
    Dim f As LocationSettingsRequestBuilder
    f.Initialize
    f.AddLocationRequest(CreateLocationRequest)
    flp.CheckLocationSettings(f.Build)
    Wait For flp_LocationSettingsChecked(LocationSettingsResult1 As LocationSettingsResult)
    Return LocationSettingsResult1
End Sub

but the cope stop in wait for (no return)

are any consideration special for android 12.
all permision (finelocation included) are allowed in device
 
Where are you initialising flp?

I have the same code in a class with android:targetSdkVersion="31" and it works fine.

However, I haven't tried it on an Android 12 phone though...
 
Upvote 0
This other code:
B4X:
    Dim p As Phone
    Dim T As String
        t = p.GetSettings ("location_providers_allowed")

return blank.. This is comment in


i have other code to initilize flp previsouly;:
B4X:
    flp.Initialize("flp")
    flp.Connect

but, maybe my problem can solved replacing the p.GetSettings ("location_providers_allowed") code

the stop (no return value) only success if are select for app:

Only while using the app:

(other question, i can view 'all the time'
)
i continue testing..
 
Upvote 0
This is comment in
as you can read there
LOCATION_PROVIDERS_ALLOWED This constant was deprecated in API level 19. This setting no longer exists from Android S onwards as it no longer is capable of realistically reflecting location settings. Use LocationManager.isProviderEnabled(java.lang.String) or LocationManager#isLocationEnabled() instead.

You shouldn´t use this any longer. Instead we have to use LocationManager.isProviderEnabled(java.lang.String) or LocationManager#isLocationEnabled()
 
Upvote 0
and this library is this (post from 2011)?:


this libreary have not the method:
isProviderEnabled

and i don't know this code LocationManager#isLocationEnabled()

is necessary jave code?
 
Upvote 0
Ok. Resuming:
For get location permision in android 12, is neccesary code java (sep 2022) using the locationManager (not b4x library, instead: code java embebed).
Thanks.
When i have the code, i put in this thread.
 
Upvote 0
Back
Top