Chrispinius
Chrispinius

Reputation: 33

PhoneGap open native map

I'm a new to phonegap and are having a problem opening the native google map application in phonegap. I have the following code

<script type="text/javascript">
              $('#btnMap').bind('tap', function(){
                             var url = 'http://maps.google.com/maps?q=Restaurant&53.9999,6.7899&z=15';
                             window.location = url;
                             });
          </script>

HTML:

<a class="buttonleft" id="#btnMap">Map</a>

Any help much appreciated.

Upvotes: 2

Views: 3820

Answers (2)

Leopd
Leopd

Reputation: 42747

The Apple docs say that opening a regular url like http://maps.google.com/maps?q=...&ll=... will load the native maps app, but that isn't working for me in iOS 5.1. Using the maps:q=...&ll=... protocol is working.

Upvotes: 3

kgaddy
kgaddy

Reputation: 48

I think your html element id is the problem.

<a class="buttonleft" id="#btnMap">Map</a>

should be:

<a class="buttonleft" id="btnMap">Map</a>

Just remove the '#'. I'm assuming you are using jquery.

Upvotes: 2

Related Questions