I am in the process of converting a GPS App to B4XPages.
The logic below to start the GPS is that found in the forum and has been working fine.
I have compiled the original program with B4A V11.0 and it works fine.
The Manifiest entry is the same as that in the forum:
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
I added log entries to the standard code and they resulted in:
GPS Enabled:true
Permission for fine access requested
*** mainpage: B4XPage_PermissionResult [mainpage]
** Activity (main) Pause event (activity is not paused). **
*** mainpage: B4XPage_Disappear [mainpage]
log ended at this point
As you can see, I never get a log results for "Permission Result", "GPS Start Request..." and "Logic fell through....".
I also note that that I get log entries indicating that B4XMainPage has disappeared which would indicate that it quit while waiting for the permission.
Is there a change required to the standard forum entry for these permissions for B4XPages?
Or, am I missing something else?
Thanks
The logic below to start the GPS is that found in the forum and has been working fine.
I have compiled the original program with B4A V11.0 and it works fine.
The Manifiest entry is the same as that in the forum:
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
I added log entries to the standard code and they resulted in:
GPS Enabled:true
Permission for fine access requested
*** mainpage: B4XPage_PermissionResult [mainpage]
** Activity (main) Pause event (activity is not paused). **
*** mainpage: B4XPage_Disappear [mainpage]
log ended at this point
As you can see, I never get a log results for "Permission Result", "GPS Start Request..." and "Logic fell through....".
I also note that that I get log entries indicating that B4XMainPage has disappeared which would indicate that it quit while waiting for the permission.
Is there a change required to the standard forum entry for these permissions for B4XPages?
Or, am I missing something else?
Thanks
B4X:
private Sub b4xpage_appear
B4XPages.SetTitle (Me,"Tour Speed Main Menu")
Log ("GPS Enabled:" & Starter.GPS1.GPSEnabled)
If Starter.GPS1.GPSEnabled = False Then
' ToastMessageShow("Please enable the GPS device.", True)
StartActivity(Starter.GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
Log ("Permission for fine access requested")
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
Log ("permission Result:" & Result)
If Result Then
Log ("GPS Start request from B4XMainMenu")
CallSubDelayed(Starter, "StartGPS")
End If
End If
Log ("Logic fell through the Permission request")