Android Tutorial Google Maps

Status
Not open for further replies.

Aviles

Member
Licensed User
Longtime User
Hello.
I load the map and all Ok, but if I change to another app, when I return to my app the map is white, the google logo load, and the buttons for zoom loads but the map is white.

now my second problem is that the map looks rare when I return to my app and call to *.getMap in Activity_resume



In the first pic is when I start my app, the second is when I change to another app and return to my app
Note: the map is not rotated

can help me?
Thanks
 

GaryK4

Member
Licensed User
Longtime User
I read a lot and tried a lot, but I just cannot get maps to work for me. All I get is a white screen. The task manager shows "Finding Location" every 1-2 seconds. The Google maps app displays fine. There was an new example app to test the white screen works.
Is there an example project for the new example?

"I've uploaded a new apk: www.b4x.com/android/files/googlemap.apk"
 

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello,
is there possible listen Snippet click event ?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Hi, where can i download the google-services.json on the external link mentioned
from the firebase console where you setup your app. After saving the new app you get a download of the json.

If i remember correctly (i setup a google maps app for a customer a few days before) you need to get the google api key from the google console. No need to use the json in your project.

If you are using firebase components in your app then you need to setup it in fb console correctly and get the json from there. You need to place the json in your apps root project folder too.
But only for google-maps you dont need to have the json

See https://www.b4x.com/android/forum/threads/google-maps.63930/ (Post #1)

Please note the comments about b4a 6.
 

cas6678

Active Member
Licensed User
Longtime User
You must add it with the designer.

Ok, I understand that I must add MapFragment from the designer, ok.

and I can activate the visible property (true or false) in the designer, ok.

But how can I do true / false this property in the code to turn off or turn on the MapFragment ???

Is possible addview (MapFragment) , for example, in a panel after create with designer ???
 

cas6678

Active Member
Licensed User
Longtime User
thanks @Erel

Now I can modify the panel (show/hide), but measure (Width & Height) of MapFragment are the same of the designer. Any way to change measure in % por all device?
 

mkvidyashankar

Active Member
Licensed User
Longtime User
Im getting this errror, where i am missing the files?

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 348)
java.lang.NoClassDefFoundError: com.google.android.gms.maps.MapFragment
at anywheresoftware.b4a.objects.MapFragmentWrapper.Initialize(MapFragmentWrapper.java:120)
at anywheresoftware.b4a.objects.MapFragmentWrapper.DesignerCreateView(MapFragmentWrapper.java:105)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:70)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at com.pci.survey.main._activity_create(main.java:348)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at com.pci.survey.main.afterFirstLayout(main.java:102)
at com.pci.survey.main.access$000(main.java:17)
at com.pci.survey.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
 

scrat

Active Member
Licensed User
Longtime User
Hello,

Before the latest googleplay update I used the old googlemap library.
Now getMap() is replaced by getMapAsync() and the old library is unusable.
With this library I can't resize dynamically by code the mapfragment.
With designer I put the mapfragment in a panel.
I can move the panel and the mapframent but I can only resize the panel, the mapfragment have always the same size.
In my app the mapfragment size is not fixed. How can I anchor mapfragment and panel

Thanks
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…