Android Question Sample GoogleMaps For B4A Version 8.8

Zeus

Member
Licensed User
I try many samples of googlemaps but i still have a blank maps
Some body have a clear sample for the B4A V 8.8
Tks
 

DonManfred

Expert
Licensed User
Upvote 0

Zeus

Member
Licensed User
Tks DonMAnfred i try these tutorial but still dont work just blank

i try this on my manifest

'************ Google Play Services Base ************
AddApplicationText(
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@Integer/google_play_services_version" />
)
'************ Google Play Services Base (end) ************

AddApplicationText(
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaxxxxxxxxxxxxxxxxxx"/> my key go here
)

*Use GoogleMap.jar 2.02
*MapFragment MyLocatation Enabled is false
*Google Play Services is run in the phone
*Google Map is running correct on the phone is a Huewey Y7
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Do you have the location permission request in the code?
B4X:
Sub MapFragment1_Ready
    gmap = MapFragment1.GetMap   
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
     gmap.MyLocationEnabled = Result
       Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
       m1.Snippet = "This is the snippet"   
End Sub
 
Upvote 0

Zeus

Member
Licensed User
Do you have the location permission request in the code?
B4X:
Sub MapFragment1_Ready
    gmap = MapFragment1.GetMap  
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
     gmap.MyLocationEnabled = Result
       Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
       m1.Snippet = "This is the snippet"  
End Sub

i dont have i put now and i will try tks
 
Upvote 0

Zeus

Member
Licensed User
Well
* add runtimepermissions(V1.10) Librery References
* Add the alexander code and i debug line by line no error all de code execute
but still blank map

this is the log

** Activity (map) Create, isFirst = true **
** Activity (map) Resume **
** Activity (map) Pause, UserClosed = false **
** Activity (map) Resume **
** Activity (map) Pause, UserClosed = true **
** Activity (panmain) Resume **
** Service (starter) Destroy (ignored)**
** Activity (panmain) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
FASCON
** Activity (main) Pause, UserClosed = false **
** Activity (panmain) Create, isFirst = true **
** Activity (panmain) Resume **
** Activity (panmain) Pause, UserClosed = false **
** Activity (map) Create, isFirst = true **
** Activity (map) Resume **
 
Upvote 0

Zeus

Member
Licensed User
TKs victor thes is my code

*********** Start Code ****************
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private MySQL As JdbcSQL
Private rp As RuntimePermissions
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.
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
End Sub

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("map")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub MapFragment1_Ready


gmap = MapFragment1.GetMap
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
gmap.MyLocationEnabled = Result
Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
m1.Snippet = "This is the snippet"

End Sub

**********End Code***************************************
 
Upvote 0

Zeus

Member
Licensed User
B4X:
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private MySQL As JdbcSQL
    Private rp As RuntimePermissions
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.
    Private gmap As GoogleMap
    Private MapFragment1 As MapFragment
End Sub

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("map")
    If MapFragment1.IsGooglePlayServicesAvailable = False Then
        ToastMessageShow("Please install Google Play Services.", True)
    End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub MapFragment1_Ready

 
gmap = MapFragment1.GetMap   
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
gmap.MyLocationEnabled = Result
Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
m1.Snippet = "This is the snippet"   
 
End Sub
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
a) Be sure you are using latest GoogleMaps library v2.02 from here.
b) Be sure set minSdkVersion="14" in your manifest file.
c) Be sure your android.geo.API_KEY

Your proyect is working fine here, with this changes.
 
Upvote 0

Zeus

Member
Licensed User
a) Be sure you are using latest GoogleMaps library v2.02 from here.
b) Be sure set minSdkVersion="14" in your manifest file.
c) Be sure your android.geo.API_KEY

Your proyect is working fine here, with this changes.
Tks Jorge I will try and i will back to coment,
Tks a lot to every body for the help Victor, Alexander, DonManfred and Jorge
 
Upvote 0

Zeus

Member
Licensed User
i try your sugestion Jorge
1) Used GoogleMap 2.02
2) i Change the Mindskversion="14" in manifest
3) i put and test my google apy key (in other plataform like xojo for web developer work proyect work)

But still blank maps, i read that posibly huawei have some problems with googlemap i will try in other devise
 
Upvote 0

Zeus

Member
Licensed User
Hi Erel Tks for the help we download the googlemap.apk that you mentions and work perfectly in the device
we will try the android key now
 
Upvote 0

DonManfred

Expert
Licensed User
we will try the android key now
if you did not used an Android key before than we have found the problem.
The Googlemap tutorial i linked in #2 explicitely mention that you need to create an Android key.
- Register your app in Google developer console: https://console.developers.google.com
You need to enable Google Maps Android API.
Then click on Credentials -> Create Credentials -> API Key -> Android Key.
You should get a key that looks like: AIzaSyCmFHamGE0O0BvxxxxxxxxXbTCSrjFVg-Q
 
Upvote 0

Similar Threads

Replies
13
Views
2K
  • Locked
  • Article
Android Tutorial Google Maps
Replies
195
Views
113K
Top