Google Map V3 and drawingmanager

ThePuiu

Active Member
Licensed User
Longtime User
Hi!
I try to put in my app a map with drawingmanager active. The Asp page that contains the same code works, but in android application it does not appear on the map. Used code is:
HTML:
<html>
<head>
<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&libraries=drawing'></script>  
<script type='text/javascript'>
    
    var drawingManager; var myLatlng = new google.maps.LatLng(46.118134, 23.478782);
    var map; 
    function initialize() {map = new google.maps.Map(document.getElementById('map_canvas'), {zoom: 12,center: myLatlng, mapTypeId: google.maps.MapTypeId.TERRAIN, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }, disableDefaultUI: true,zoomControl: true,streetViewControl: true, scrollwheel: true, disableDoubleClickZoom: false, draggable: true, keyboardShortcuts: true, mapTypeControl: true,navigationControl: true, scaleControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, position: google.maps.ControlPosition.TOP_RIGHT },navigationControlOptions: { style: google.maps.NavigationControlStyle.DEFAULT }})
    var polyOptions = {strokeWeight: 0,fillOpacity: 0.45,editable: true}; drawingManager = new google.maps.drawing.DrawingManager({drawingMode: google.maps.drawing.OverlayType.POLYGON,drawingControlOptions: { drawingModes: [google.maps.drawing.OverlayType.POLYGON] },polygonOptions: polyOptions, map: map});
    google.maps.event.addListener(map, 'click', function (myMouseEvent) { var clickedLocation = myMouseEvent.latLng.toUrlValue(); B4A.CallSub('HandleMapClick', true, clickedLocation); });
    var marker1 = new google.maps.Marker({ position: new google.maps.LatLng(46.118134, 23.478782), map: map, title: 'A', clickable: true, draggable: true, icon: 'http://www.google.com/mapfiles/arrow.png' });}
    google.maps.event.addDomListenerOnce(window, 'load', initialize);
</script>
</head>
<body onload=initialize()>  
<div id='map_canvas' style='width:100%; height:100%'>
</div>
</body>
</html>

Can someone tell me what am I doing wrong?
I need this to allow users to draw polygons on the map. If you can give me another option that can do this i'll thank you!
 

ThePuiu

Active Member
Licensed User
Longtime User
Hi Erel,
I tried to modify the existing project and include the new Google library. I downloaded Google Play services, I got a valid key, I Copy google-play-services.jar to the libraries folder and I copy suggested code to the end of my manifest (using Manifest Editor). I have compiled application without receiving any error message, but when to install the application on the tablet, I get the message: There is a problem parsing the package. I tried to use the emulator, but there I get the message: Installing file to device. Error
pkg: /data/local/tmp/Natura2000.apk
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

Restarting ADB Server may solve this problem.
Tools - Restart ADB Server. Device serial: emulator-5554

Your test application works perfectly on my tablet.
Pls, if you can, tell me what is wrong!
Attached is my Manifest file.
 

Attachments

  • AndroidManifest.zip
    940 bytes · Views: 259
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
HTML:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddManifestText( <permission android:name="$PACKAGE$.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>        
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>)        
AddApplicationText(<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBvCLGYm9tlexqQNZBCxrTG-d-ZaBkhF-o"/>)
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
Hi Erel!

Attached is the project that fail to use Google Map. Most likely is a problem with the manifest file.

Thanks for your help!
 

Attachments

  • project.zip
    127 KB · Views: 273
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
Hi Erel!

You tried to change the manifest file in my project and it worked? I ask this because I tried to change permissions as you said and it still does not work properly. Should I try to change everything in Manifest.xml file in lowercase (using another editor xml)? Or, could you possibly attach my project in version that worked for you to see what changes you made​​?

Thanks for the help ... time passes and the project deadline approaches ...
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
I changed capitalization of packagename and now the application is installed on the tablet. The problem is that the map does not appear although it gives no error message ... screen remains white. Only zoom control apear. It is possible that key obtained from Google will no longer be valid? The code used is copied from your example.

TY!
 
Upvote 0
Top