Android Question Google map Not showing

AndroidMadhu

Active Member
Licensed User
HelloAll,
I am following Erel's example while trying to add google map. [ https://www.b4x.com/android/forum/threads/google-maps.63930/]
Compilation is done perfectly. Also Generated the Google API key which I have added at manifest.xml file.
But nothing is showing at the map. I have also added GoogleMap, Runtimepermisson library.
The below is the code.
B4X:
Private rp As RuntimePermissions
End Sub

Sub Globals
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
Wait For MapFragment1_Ready
gmap = MapFragment1.GetMap
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
gmap.MyLocationEnabled = True
Else
Log("No permission!")
End If
End Sub

Sub MapFragment1_Click (Point As LatLng)
gmap.AddMarker(Point.Latitude, Point.Longitude, "New Marker")
End Sub

Please suggest
 

DonManfred

Expert
Licensed User
Longtime User
If you get a blank map most probably the api key is not valid/not correct.
Note that it can take some time for a apikey to be valid in Android.
 
Upvote 0

AndroidMadhu

Active Member
Licensed User
I have activated/Enabled almost all the Library at Google MAP website. [API & Services-> Library->Maps]. The I enabled all the MAPs.
Still I have not able to see any Map at my mobile.
Below is my manifest file details :
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true"
      android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)

AddApplicationText(
<meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="xxxxxxxx"/>
)

AddApplicationText(
<uses-library
          android:name="org.apache.http.legacy"
          android:required="false" />
)

Any Mistake I am doing?please suggest
 
Upvote 0
Top