¡Hola a todos!
Estoy aprendiendo a desarrollar aplicaciones en B4xPages y actualmente estoy trabajando en un programa que tiene como objetivo calcular la ubicación más precisa de donde uno se encuentra.
Cuando abro el programa, comienza a capturar las coordenadas y las promedia, mostrando la posición en un mapa. En un principio, el programa funcionaba correctamente. Sin embargo, después de realizar algunos ajustes, dejó de funcionar. He estado intentando solucionarlo durante un tiempo, pero hasta ahora no he tenido éxito.
En el registro de errores (Log) aparece el mensaje "java.lang.RuntimeException: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION".
Antes de comenzar a capturar las coordenadas en el código, solicito el permiso correspondiente para hacerlo.
Cualquier ayuda o sugerencia sería muy apreciada. ¡Gracias!
Adjunto el proyecto.
Estoy aprendiendo a desarrollar aplicaciones en B4xPages y actualmente estoy trabajando en un programa que tiene como objetivo calcular la ubicación más precisa de donde uno se encuentra.
Cuando abro el programa, comienza a capturar las coordenadas y las promedia, mostrando la posición en un mapa. En un principio, el programa funcionaba correctamente. Sin embargo, después de realizar algunos ajustes, dejó de funcionar. He estado intentando solucionarlo durante un tiempo, pero hasta ahora no he tenido éxito.
En el registro de errores (Log) aparece el mensaje "java.lang.RuntimeException: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION".
Antes de comenzar a capturar las coordenadas en el código, solicito el permiso correspondiente para hacerlo.
B4X:
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
rp.CheckAndRequest(rp.PERMISSION_ACCESS_COARSE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
Cualquier ayuda o sugerencia sería muy apreciada. ¡Gracias!
Adjunto el proyecto.
B4X:
Logger connected to: Blackview BV9300
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** 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.zzac.zzb(com.google.android.gms:play-services-maps@@18.1.0:1)
at com.google.android.gms.maps.internal.zzar.zza(com.google.android.gms:play-services-maps@@18.1.0:6)
at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms:play-services-maps@@18.1.0:3)
at android.os.Binder.transact(Binder.java:1064)
at m.fe.c(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at com.google.maps.api.android.lib6.impl.bg.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7893)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
at com.google.maps.api.android.lib6.impl.bk.J(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):11)
at com.google.android.gms.maps.internal.i.bb(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):208)
at m.ff.onTransact(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):4)
at android.os.Binder.transact(Binder.java:1064)
at com.google.android.gms.internal.maps.zza.zzc(com.google.android.gms:play-services-maps@@18.1.0:2)
at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:3)
at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:1)
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
... 14 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
** 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.zzac.zzb(com.google.android.gms:play-services-maps@@18.1.0:1)
at com.google.android.gms.maps.internal.zzar.zza(com.google.android.gms:play-services-maps@@18.1.0:6)
at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms:play-services-maps@@18.1.0:3)
at android.os.Binder.transact(Binder.java:1064)
at m.fe.c(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at com.google.maps.api.android.lib6.impl.bg.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7893)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
at com.google.maps.api.android.lib6.impl.bk.J(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):11)
at com.google.android.gms.maps.internal.i.bb(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):208)
at m.ff.onTransact(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):4)
at android.os.Binder.transact(Binder.java:1064)
at com.google.android.gms.internal.maps.zza.zzc(com.google.android.gms:play-services-maps@@18.1.0:2)
at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:3)
at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:1)
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
... 14 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
** 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.zzac.zzb(com.google.android.gms:play-services-maps@@18.1.0:1)
at com.google.android.gms.maps.internal.zzar.zza(com.google.android.gms:play-services-maps@@18.1.0:6)
at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms:play-services-maps@@18.1.0:3)
at android.os.Binder.transact(Binder.java:1064)
at m.fe.c(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at com.google.maps.api.android.lib6.impl.bg.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7893)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
at com.google.maps.api.android.lib6.impl.bk.J(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):11)
at com.google.android.gms.maps.internal.i.bb(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):208)
at m.ff.onTransact(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):4)
at android.os.Binder.transact(Binder.java:1064)
at com.google.android.gms.internal.maps.zza.zzc(com.google.android.gms:play-services-maps@@18.1.0:2)
at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:3)
at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:1)
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
... 14 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
** 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.zzac.zzb(com.google.android.gms:play-services-maps@@18.1.0:1)
at com.google.android.gms.maps.internal.zzar.zza(com.google.android.gms:play-services-maps@@18.1.0:6)
at com.google.android.gms.internal.maps.zzb.onTransact(com.google.android.gms:play-services-maps@@18.1.0:3)
at android.os.Binder.transact(Binder.java:1064)
at m.fe.c(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at com.google.maps.api.android.lib6.impl.bg.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7893)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
at com.google.maps.api.android.lib6.impl.bk.J(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):11)
at com.google.android.gms.maps.internal.i.bb(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):208)
at m.ff.onTransact(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):4)
at android.os.Binder.transact(Binder.java:1064)
at com.google.android.gms.internal.maps.zza.zzc(com.google.android.gms:play-services-maps@@18.1.0:2)
at com.google.android.gms.maps.internal.zzg.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:3)
at com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(com.google.android.gms:play-services-maps@@18.1.0:1)
at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:184)
... 14 more