Hi everyone,
I have created the app by follow Erel 's googlemap v2 tutorial and worked!!.
I want to add googlemap v2 to Corwin 's AHViewPager but It 's not work the app crash at run time.
I try theses steps
1.Create app base on Corwin's NavigatoinView1_0.zip sample project.
from this link https://www.b4x.com/android/forum/threads/designsupport-additional-material-design-components.58893/
I added google play service configurations to manifest and include all jars and resources in activity.
2.add 3 panels to the Page Container
3.Load Map Layout
4.run the app
the app crash when change page from page 1 to page 2
==============
--------- beginning of crash
--------- beginning of main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
PageCreated: 0
PageCreated: 1
StateChange: 1
StateChange: 2
PageChanged: 1
PageCreated: 2
StateChange: 0
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:196)
at com.google.android.gms.maps.zzaa.zza(Unknown Source)
at com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at gl.bcom.google.android.gms.DynamiteModulesB:20)
at com.google.android.gms.maps.internal.bf.acom.google.android.gms.DynamiteModulesB:5)
at com.google.maps.api.android.lib6.impl.bb.runcom.google.android.gms.DynamiteModulesB:5)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5452)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:762)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
at com.google.maps.api.android.lib6.impl.az.ccom.google.android.gms.DynamiteModulesB:675)
at com.google.android.gms.maps.internal.k.onTransactcom.google.android.gms.DynamiteModulesB:141)
at android.os.Binder.transact(Binder.java:387)
at com.google.android.gms.internal.zzed.zzb(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:183)
... 13 more
==============
I try to solve the problem but I can't.
Regards,
I have created the app by follow Erel 's googlemap v2 tutorial and worked!!.
I want to add googlemap v2 to Corwin 's AHViewPager but It 's not work the app crash at run time.
I try theses steps
1.Create app base on Corwin's NavigatoinView1_0.zip sample project.
from this link https://www.b4x.com/android/forum/threads/designsupport-additional-material-design-components.58893/
I added google play service configurations to manifest and include all jars and resources in activity.
2.add 3 panels to the Page Container
B4X:
Sub Activity_Create(FirstTime As Boolean)
...
Dim pn1 As Panel
Dim pn2 As Panel
Dim pnMap As Panel
pn1 .Initialize("")
pn2 .Initialize("")
pnMap .Initialize("")
'if I load map layout here the app crash at first run time then I will load later at VP_PageCreated event
'there are 3 pages
PC.AddPage(pn1, "page1") 'empty page
PC.AddPage(pn2, "page2") 'empty page
PC.AddPage(pnMap, "page3") 'empty page
...
End Sub
3.Load Map Layout
B4X:
Sub VP_PageCreated (Position As Int, Page As Object)
Dim pn As Panel
If Position =2 Then 'page 3 for map
pn = Page
pn.LoadLayout("mymap")
End If
End Sub
4.run the app
the app crash when change page from page 1 to page 2
==============
--------- beginning of crash
--------- beginning of main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
PageCreated: 0
PageCreated: 1
StateChange: 1
StateChange: 2
PageChanged: 1
PageCreated: 2
StateChange: 0
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:196)
at com.google.android.gms.maps.zzaa.zza(Unknown Source)
at com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at gl.bcom.google.android.gms.DynamiteModulesB:20)
at com.google.android.gms.maps.internal.bf.acom.google.android.gms.DynamiteModulesB:5)
at com.google.maps.api.android.lib6.impl.bb.runcom.google.android.gms.DynamiteModulesB:5)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5452)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:762)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
at com.google.maps.api.android.lib6.impl.az.ccom.google.android.gms.DynamiteModulesB:675)
at com.google.android.gms.maps.internal.k.onTransactcom.google.android.gms.DynamiteModulesB:141)
at android.os.Binder.transact(Binder.java:387)
at com.google.android.gms.internal.zzed.zzb(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:183)
... 13 more
==============
I try to solve the problem but I can't.
Regards,