Android Question Maps only for developers

pazzokli

Active Member
Licensed User
Longtime User
Hi, somebody know why when I open maps with this code appear "for development use only"? I don't remember where I took it

B4X:
Sub DispMap(CenterLat As Float, CenterLong As Float, Zoom As Int, MapTypeControl As Boolean, MapZoomControl As Boolean, ZoomControlPosition As String, MapScaleControl As Boolean, ScaleControlPosition As String, DispMarkerCenter As Boolean, MarkerLat As Double, MarkerLong As Double, DispMarkers As Boolean, DispPolyline As Boolean, PolyLineColor As String, PolyLineOpacity As Float, PolyLineWidth As Int)
    ' CenterLat        = latitude of map center in degrees
    ' CenterLong       = longitude of map center in degrees
    ' Zoom             = zomm index   0 - 21
    ' MapTypeControl   = true displays the map type control
    ' DispZoomControl  = true displays the zoom control otherwise false
    ' ZoomControlPosition  = position of the zoom control TOP_LEFT, TOP_CENTER, TOP_RIGHT, LEFT_CENTER, RIGHT_CENTER, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT
    ' ScaleControl     = true displays the zoom control otherwise false
    ' ScaleControlPosition  = position of the scale control TOP_LEFT, TOP_CENTER, TOP_RIGHT, LEFT_CENTER, RIGHT_CENTER, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT
    ' DispMarkerCenter = true sets a marker on the center of the map
    ' MarkerLat            = List of lat  positions of the markers
    ' MarkerLong            = List of long positions of the markers
    ' DipsMarkers           = true displays the markers
    ' DispPolyline        = true displays a polyline with the markers as vertices
    ' PolyLineColor    = polyline color hexadecimal  #ff0000 = red  #00ff00 = green   #0000ff = blue
    ' PolyLineOpacity  = polyline opacity  0.0  transparent   1.0 full opaque
    ' PolyLineWidth    = polyline width in pixels
    
    Dim HtmlCode As String
    Dim i, j As Int
    
    HtmlCode = "<!DOCTYPE html><html><head><meta name='viewport' content='initial-scale=1.0, user-scalable=no' /><style type='text/css'>  html { height: 100% }  body { height: 100%; margin: 0px; padding: 0px }#map_canvas { height: 100% }</style><script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=true'></script><script type='text/javascript'> function initialize() {var centerlatlng = new google.maps.LatLng(" & CenterLat & "," & CenterLong & "); var myOptions = { zoom: "&Zoom&", center: centerlatlng, disableDefaultUI: true, zoomControl: "& MapZoomControl & ", zoomControlOptions: {position: google.maps.ControlPosition." & ZoomControlPosition & "}, scaleControl: "& MapScaleControl & ", scaleControlOptions: {position: google.maps.ControlPosition." & ScaleControlPosition & "}, mapTypeControl: "& MapTypeControl& ", mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById('map_canvas'),  myOptions)"

    
    
    
    HtmlCode = HtmlCode & "; var markerc = new google.maps.Marker({    position: new google.maps.LatLng(" & CenterLat & "," & CenterLong & "),map: map, title: 'Antena',clickable: false,icon: 'http://www.google.com/mapfiles/arrow.png' })"
    
    HtmlCode = HtmlCode & "; }</script></head><body onload='initialize()'>  <div id='map_canvas' style='width:100%; height:100%'></div></body></html>"
    
    WebView1.LoadHtml(HtmlCode)

End Sub
 

walterf25

Expert
Licensed User
Longtime User
You need to get an API key from the google Console.

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