Android Question Problem whit Permissions at runtime in Google Maps

marco_2063

Member
Licensed User
Longtime User
Hi,
I've a problem during compilation when I add a Runtime Permissions library (ver. 1.10).
In few word my script able to view a Map (GoogleMaps library ver. 1.01) on a Panel run ok and is correctly installed.
If I add a Runtime Permission library (without write any aggiuntive code) I have this error during compilation.
What I can do?
Thanks for any help!!!


B4A Versione: 8.50
Analisi del Codice. (0.00s)
Building folders structure. (0.04s)
Compilazione del codice. (0.01s)
Compilazione del codice di layouts (0.00s)
Organizzazione Librerie. (0.00s)
Generazione file R. (0.52s)
Compilazione del codice Java prodotto. Error
B4A line: 50
GoogleMap1.AnimateCamera(cp)
javac 1.8.0_102
src\b4a\example\main.java:389: error: package com.google.android.gms.maps.model does not exist
mostCurrent._googlemap1.AnimateCamera((com.google.android.gms.maps.model.CameraPosition)(_cp.getObject()));
^
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

marco_2063

Member
Licensed User
Longtime User
Hi DonManfred,
I Have done all you told me. Thank you!!
It seems ok, but after installation it crash !!
Yes I'm using B4A SDKManager.
Help me...
 
Upvote 0

marco_2063

Member
Licensed User
Longtime User
Sorry for the generic information...
"the indirizzi program has been stopped"



B4X:
#Region  Project Attributes
    #ApplicationLabel: indirizzi
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #AdditionalJar: com.google.android.gms:play-services-maps
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
    
#End Region

#BridgeLogger: true


Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private gmap As GoogleMap
    Private MapFragment1 As MapFragment
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("1")
    If MapFragment1.IsGooglePlayServicesAvailable = False Then
        ToastMessageShow("Please install Google Play Services.", True)
    End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub MapFragment1_Ready
    gmap = MapFragment1.GetMap
    Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
    m1.Snippet = "This is the snippet"
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Are you requesting the permission with Runtimepermissions lib?

B4X:
Sub MapFragment1_Ready
   gmap = MapFragment1.GetMap
   rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
   wait for  Activity_PermissionResult (Permission As String, Result As Boolean)
   gmap.MyLocationEnabled = Result
End Sub
 
  • Like
Reactions: eps
Upvote 0

marco_2063

Member
Licensed User
Longtime User
here it is !



B4X:
Per favore aggiorna a B4A-Bridge v2.30+
Logger connesso a:  samsung SM-G903F-355001072432791
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.RuntimeException: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:197)
    at com.google.android.gms.maps.zzab.zza(Unknown Source)
    at com.google.android.gms.maps.internal.zzaq.dispatchTransaction(Unknown Source)
    at com.google.android.gms.internal.maps.zzb.onTransact(Unknown Source)
    at android.os.Binder.transact(Binder.java:387)
    at ft.b(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):15)
    at com.google.android.gms.maps.internal.bg.a(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at com.google.maps.api.android.lib6.impl.bj.run(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7230)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
    at com.google.maps.api.android.lib6.impl.bf.c(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):566)
    at com.google.android.gms.maps.internal.l.a(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):361)
    at fu.onTransact(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at android.os.Binder.transact(Binder.java:387)
    at com.google.android.gms.internal.maps.zza.transactAndReadExceptionReturnVoid(Unknown Source)
    at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(Unknown Source)
    at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(Unknown Source)
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
    ... 14 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.RuntimeException: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:197)
    at com.google.android.gms.maps.zzab.zza(Unknown Source)
    at com.google.android.gms.maps.internal.zzaq.dispatchTransaction(Unknown Source)
    at com.google.android.gms.internal.maps.zzb.onTransact(Unknown Source)
    at android.os.Binder.transact(Binder.java:387)
    at ft.b(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):15)
    at com.google.android.gms.maps.internal.bg.a(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at com.google.maps.api.android.lib6.impl.bj.run(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7230)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
    at com.google.maps.api.android.lib6.impl.bf.c(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):566)
    at com.google.android.gms.maps.internal.l.a(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):361)
    at fu.onTransact(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at android.os.Binder.transact(Binder.java:387)
    at com.google.android.gms.internal.maps.zza.transactAndReadExceptionReturnVoid(Unknown Source)
    at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(Unknown Source)
    at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(Unknown Source)
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
    ... 14 more
--------- beginning of system
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.RuntimeException: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:197)
    at com.google.android.gms.maps.zzab.zza(Unknown Source)
    at com.google.android.gms.maps.internal.zzaq.dispatchTransaction(Unknown Source)
    at com.google.android.gms.internal.maps.zzb.onTransact(Unknown Source)
    at android.os.Binder.transact(Binder.java:387)
    at ft.b(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):15)
    at com.google.android.gms.maps.internal.bg.a(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at com.google.maps.api.android.lib6.impl.bj.run(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7230)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
    at com.google.maps.api.android.lib6.impl.bf.c(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):566)
    at com.google.android.gms.maps.internal.l.a(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):361)
    at fu.onTransact(:com.google.android.gms.dynamite_mapsdynamite@14574047@14.5.74 (040308-219897028):4)
    at android.os.Binder.transact(Binder.java:387)
    at com.google.android.gms.internal.maps.zza.transactAndReadExceptionReturnVoid(Unknown Source)
    at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(Unknown Source)
    at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(Unknown Source)
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
    ... 14 more
 
Upvote 0

marco_2063

Member
Licensed User
Longtime User
No no

Are you requesting the permission with Runtimepermissions lib?

B4X:
Sub MapFragment1_Ready
   gmap = MapFragment1.GetMap
   rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
   wait for  Activity_PermissionResult (Permission As String, Result As Boolean)
   gmap.MyLocationEnabled = Result
End Sub
 
Upvote 0
Top