Android Question "White Map" with Google Maps v2

Walter Adriano da Silva

Member
Licensed User
Longtime User
Hello there,

I'm using Google Maps v2 for an app, and have right configs in Google API Key, AdditionalRes and Manifest, but the panel persist in show me a "White Map".



One can imagine where is the error?

Thank you in advance.
 

abhishek007p

Active Member
Licensed User
Longtime User
Does this still work?

The map shows just fine but the given functions (addmarker, etc), and events does not trigger.



Here is the unfiltered logs. When i click on the map, it will show this "Failed to acquire lock." on the log.




Im currently using B4A 5.20 and android 5.1.1

B4X:
#Region  Project Attributes
   #ApplicationLabel: Sample
   #VersionCode: 100
   #VersionName: 1.0
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: portrait
   #CanInstallToExternalStorage: False
   'Replace this with your own path of google play service lib
   #AdditionalRes: C:\android\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region

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

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.
  Dim mFragment As MapFragment
  Dim gmap As GoogleMap
  Dim MapPanel As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.Initialize("Activity")
   MapPanel.Initialize("")
   Activity.AddView(MapPanel, 0, 0, 100%x, 100%y)
   If mFragment.IsGooglePlayServicesAvailable = False Then
     ToastMessageShow("Google Play services not available.", True)
   Else
     mFragment.Initialize("mapFragment", MapPanel)
   End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub mapFragment_Click (Point As LatLng)
   Log("<Map Click/Touch>")  
End Sub
Sub mapFragment_MarkerClick (SelectedMarker As Marker) As Boolean 'Return True to consume the click
   Log("<Marker Selected>")
   Return False
End Sub
Sub mapFragment_CameraChange (Position As CameraPosition)
   Log("<Camera Position Change>")  
End Sub
Sub mapFragment_Ready
   Log("<Map Ready>")
   gmap = mFragment.GetMap
   If gmap.IsInitialized = False Then
     ToastMessageShow("Error initializing map.", True)
   Else
     gmap.MyLocationEnabled = True    
     gmap.MapType = gmap.MAP_TYPE_TERRAIN
     '
     gmap.AddMarker(10.5308, 30.3331, "This is a marker")
     Dim cp As CameraPosition
     cp.Initialize(10.5308, 30.3331, gmap.CameraPosition.Zoom)
     gmap.AnimateCamera(cp)
   End If
End Sub
 
Upvote 0

kalmen

Member
Licensed User
Longtime User
yup ,after today map and various update in my tablet , the googlemap and some of my project are not able to run , perhaps some library has broken !
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
and its not working. mapp appears but no marker.
This example doesn't show a marker.

I tried it with this code and it shows a marker:
B4X:
Sub Globals
  Dim mFragment1 As MapFragment
  Dim gmap As GoogleMap
  Dim MapPanel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
  MapPanel1.Initialize("")
  Activity.AddView(MapPanel1, 0, 0, 100%x, 100%Y)
  If mFragment1.IsGooglePlayServicesAvailable = False Then
    ToastMessageShow("Google Play services not available.", True)
  Else
    mFragment1.Initialize("Map1", MapPanel1)
  End If
End Sub

Sub Map1_Ready
   gmap = mFragment1.GetMap
   gmap.AddMarker(30, 30, "test")
End Sub

Did it stop working at one point? Which version of Google Play Services are you using?
 
Upvote 0

panic

Member
Licensed User
Longtime User
I have B4A v6.0, Google Play Services 31, Google Repository 31 and API 23 & 24. I have tested the Google Maps v2 example and displays "white map". I downloaded also the googlemaps.apk and displays "white map" as well. Tested on two different devices LG G3 one rooted the other unrooted with the same (negative) result.

Google Play seems working as expected on both devices.

Any suggestions?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…