2

Im using PhoneGap to build an app. In this app I'want to create a geo link. PhoneGap does open a map with the right location on it, but the map is not Google Maps or Apple maps. Instead it opens a weird looking map.

I'm using AngularJS as a Framework

Right now I'm using this:

<a href="geo:53.33196,6.92583">View on Google Maps</a>

Is there a way that the app will open up the Google Maps downloaded from the Play Store?

Thanks!

3
  • on which device you are testing ? Android or Apple ?
    – AAhad
    Oct 22, 2014 at 7:25
  • I'm testing on Android first Oct 22, 2014 at 7:27
  • Do you have Google Maps App installed on device?
    – AAhad
    Oct 22, 2014 at 7:28

1 Answer 1

6

Try to add the following to config.xml

<access origin="geo:*" launch-external="yes"/>

And try this:

  1. Create a custom function in JS and use it to open default Maps App on the device

    var app = {
        initialize: function() {
        this.bindEvents();
    },         
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },         
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    openNativeAppWindow: function(data) {
        window.open(data, '_system');
    }
    

    };

  2. The place where you are invoking Maps links then pass on your custom url with data and let it open the native browser window which in turn will push the native Maps App to handle the special urls.

Few example:

<input type="button" onClick="app.openNativeAppWindow('http://google.com')" value="Open Google"/>
            <br><br><a onClick="app.openNativeAppWindow('geo://0,0?q=dallas')" data-rel="external">google maps</a>
            <br><br><a onClick="app.openNativeAppWindow('geo:0,0?q=Bacau')">Geolocation Test</a>
            <br><br><a onClick="app.openNativeAppWindow('geo:0,0?q=34.99,-106.61(Treasure)')">longitude & latitude with a string label</a>
            <br><br><a onClick="app.openNativeAppWindow('geo:0,0?q=1600+Amphitheatre+Parkway%2C+CA')">street address Test</a>
2
  • try this and let me know
    – AAhad
    Oct 22, 2014 at 7:35
  • It did the trick! I just edited the link to maps.google.com So I have more control over the map Oct 22, 2014 at 7:42

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.