https://www.b4x.com/android/forum/threads/google-maps.63930/#post-404386Some body have a clear sample for the B4A V 8.8
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
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
#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
Yes i have bookmarked your comment this is the perfect tutorial!heeeeyyyy, these are MY pictures
Tks Jorge I will try and i will back to coment,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.
if you did not used an Android key before than we have found the problem.we will try the android key now
- 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