I wonder if anyone can help with a problem I am having.
I have an app which is using GoogleMaps within an activity.
In the activity_create I have
In the Map_ready event I have
However, I am getting crash reports in Crashlytics which say the following:
The crash seems to suggest that the user did not approve the ACCESS_FINE_LOCATION permission, which is odd because the Activity_Create should exit.
Does anyone have any ideas why this is happening?
Thanks
I have an app which is using GoogleMaps within an activity.
In the activity_create I have
B4X:
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Not(Result) Then
Msgbox("You need to approve Location Permissions to view the map",Starter.gstrApplicationTitle)
Activity.Finish
End If
In the Map_ready event I have
B4X:
gmap = mfMap.GetMap
gmap.MyLocationEnabled = True
gmap.MapType = gmap.MAP_TYPE_NORMAL
However, I am getting crash reports in Crashlytics which say the following:
Fatal Exception: java.lang.SecurityException
my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
com.google.maps.api.android.lib6.impl.bf.c com.google.android.gms.dynamite_mapsdynamite@14366051@14.3.66 (040408-213742215):551)
com.google.android.gms.maps.internal.l.a com.google.android.gms.dynamite_mapsdynamite@14366051@14.3.66 (040408-213742215):277)
fq.onTransact com.google.android.gms.dynamite_mapsdynamite@14366051@14.3.66 (040408-213742215):4)
android.os.Binder.transact (Binder.java:628)
com.google.android.gms.internal.maps.zza.transactAndReadExceptionReturnVoid (Unknown Source:7)
com.google.android.gms.maps.internal.zzg.setMyLocationEnabled (Unknown Source:9)
com.google.android.gms.maps.GoogleMap.setMyLocationEnabled (Unknown Source:2)
anywheresoftware.b4a.objects.MapFragmentWrapper$GoogleMapWrapper.setMyLocationEnabled (MapFragmentWrapper.java:307)
uk.co.digitwell.interdirect.mkccm.parkmycar._mfmap_ready (parkmycar.java:1377)
The crash seems to suggest that the user did not approve the ACCESS_FINE_LOCATION permission, which is odd because the Activity_Create should exit.
Does anyone have any ideas why this is happening?
Thanks