I am building a gps app but a can't seem to get the run time permissions right. Is there a best practice in how to use them?
I added this to the Activity_Create
and this to the manifest
in the Activity_PermissionResult
but when it goes through the Activity_resume where this code is placed
I get an error telling me that I need the android.permission.ACCESS_FINE_LOCATION
I am obviously doing something wrong, but I can't figure it out.
Thanks
I added this to the Activity_Create
B4X:
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
and this to the manifest
B4X:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
in the Activity_PermissionResult
B4X:
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = rp.PERMISSION_ACCESS_COARSE_LOCATION Then
Result = True
End If
End Sub
but when it goes through the Activity_resume where this code is placed
B4X:
If (Starter.nfpGPS.GPSEnabled) Then
Starter.nfpGPS.Start(0, 0) 'Listen to GPS with no filters.
Else
ToastMessageShow(Starter.nfpEnableGPS, True)
StartActivity(Starter.nfpGPS.LocationSettingsIntent) 'Will open the relevant settings screen.
End If
I get an error telling me that I need the android.permission.ACCESS_FINE_LOCATION
I am obviously doing something wrong, but I can't figure it out.
Thanks