Android Question google maps not work. white map in device

Andres Gomez

New Member
Licensed User
i download the googlemaps.apk and work ok

my app not work. Attach app

can you help me?
 

Attachments

  • mapa.zip
    9.6 KB · Views: 268

Andres Gomez

New Member
Licensed User
attach api key
 

Attachments

  • api key.png
    api key.png
    63 KB · Views: 465
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
my app not work
As you are using targetsdk 26 then you need to use Runtimepermissions.
Check: https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/

attach api key
It is included in the manifest

B4X:
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("mapa")
    If MapFragment1.IsGooglePlayServicesAvailable = False Then
        ToastMessageShow("Please install Google Play Services.", True)
    End If
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_COARSE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)

 
End Sub
It does not work for me as i am using your api key. Probably the apikey is wrong or limited.

I replaced the api key with a one from me and then the map shows up here.

WhatsApp Image 2018-05-08 at 21.16.17.jpeg

I suggest to start with generating a new key and resticting it to your app.

Also add Runtimepermissions to your app and request the three dangerous permissions.

Also note the comment from Erel

- You should set the My Location Enabled property to False in the designer and enable it after you request the permission:
Example: https://www.b4x.com/android/forum/t...ty-exemptions-on-android-7.88995/#post-563422

1. Disable mylocation in the designerlayout
2.
B4X:
Sub MapFragment1_Ready
    gmap = MapFragment1.GetMap
    gmap.MyLocationEnabled = True
  
    Dim m1 As Marker = gmap.AddMarker(41.6692150, -0.8886870, "test")
    m1.Snippet = "This is the snippet"
End Sub
 
Last edited:
Upvote 0
Top