3

I have an application in PhoneGap to Android, I use Android 2.2 device and Phone Gap 2.2.0 version ..

I want to allow the user by the fingers to zoom map

(on devices with more advanced versions it works!)

Why on this version is not working?

Do I need to define something to make it work?

It's my link to Google Maps in HTML:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>

These are the permissions on the file Manifest.xml:

<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Hodaya Shalom
  • 4,327
  • 12
  • 57
  • 111

4 Answers4

2

Have you got user-scalable=yes set in your viewport?

Clinton Ward
  • 2,441
  • 1
  • 22
  • 26
  • 1
    try map = new google.maps.Map({ zoom : true }); // upon initialization map.setOptions({ zoom: true }); // or in runtime – Clinton Ward Jan 16 '13 at 08:45
  • 1
    http://stackoverflow.com/questions/6342705/google-maps-using-phonegap-in-android read the comments below, do they help? – Clinton Ward Jan 16 '13 at 09:00
  • Its not my problem, I hava problem only with the zooming – Hodaya Shalom Jan 16 '13 at 09:06
  • 1
    the guy said he did not have zooming in the comments, and suggestion was Here are some other things to check: Does the manifest file allow location? android.permission.ACCESS_FINE_LOCATION android.permission.ACCESS_COARSE_LOCATION What's on map page (blank screen, error msg, or ?) Check DDMS after clicking on small map? Verify GPS is working by loading maps.google.com in browser and enable location. Add alert() here to confirm change page is happening: $('#map_square').click( function() { $.mobile.changePage('#page-map', 'slide'); }); – Clinton Ward Jan 16 '13 at 09:16
  • Does the manifest file allow location?- yes What's on map page (blank screen, error msg, or ?) -I dont have problem with the map, Check DDMS after clicking on small map?- I use in device not emulator, Verify GPS is working by loading maps.google.com in browser and enable location- I do not use GPS, and i can to find my location, $('#map_square').click( function() { $.mobile.changePage('#page-map', 'slide'); });- for what this? – Hodaya Shalom Jan 16 '13 at 09:19
2

It may be a hardware issue. Many (older) android devices do not support multi-touch. You can't use pinch to zoom if your device doesn't support it.

Check android: how can I verify, that device support multitouch?

Community
  • 1
  • 1
danijel
  • 576
  • 4
  • 10
1

if you set attribute user-scalable=yes unsuccessfull,You could try this in Activity extend from DroidGap.

super.appView.getSettings().setSupportZoom(true);
    super.appView.getSettings().setBuiltInZoomControls(true);
judgement
  • 437
  • 3
  • 12
  • It will not let me run the application so .. I put it before the super.loadUrl ("file :/ / / android_asset / www / XXX.html"); – Hodaya Shalom Jan 16 '13 at 08:42
  • super.loadUrl("file :/ / / android_asset / www / XXX.html",2000);// super.appView.getSettings().setSupportZoom(true); super.appView.getSettings().setBuiltInZoomControls(true); In my app, i just use this – judgement Jan 16 '13 at 08:58
  • It works! But it does zoom on all the application not on the map! – Hodaya Shalom Jan 16 '13 at 09:00
  • 1
    so. Set your view port ' ' and remove my zoom code. Try: var mapOptions = { zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); – judgement Jan 16 '13 at 09:16
  • 1
    In main.xml file add a new attr: map:uiZoomControls="true" map:uiZoomGestures="true" Or map.getUiSettings().setZoomControlsEnabled(boolean enabled) ;map.getUiSettings().setZoomGesturesEnabled(true); – judgement Jan 16 '13 at 09:37
  • Sorry about my Attribute. It on Native code of Google map for android. And This a my map on Phonegap, Html code. :) http://www.mediafire.com/?3mr4oh3bh3gympw . Hope it could help – judgement Jan 16 '13 at 10:24
  • It's my fault. Sorry about that. It on Native code for Android not html code – judgement Jan 17 '13 at 01:35
1

So you're emulator is running Android 2.2 (Froyo) correct? If so, first check to see what API installs you have in your environment. Sounds elementary but you want to check your packages and if you can Update each time you switch your API level. (e.g. Fryo is API level 8)

Fryo API Android 2.2 Also, have you tried manipulating your intent using object gestures specified for 2.2.

ScaleGestureDectectorClass

Hope this helps you!

Abraxas
  • 374
  • 3
  • 10