Reputation: 401
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!
Upvotes: 2
Views: 4861
Reputation: 2845
Try to add the following to config.xml
<access origin="geo:*" launch-external="yes"/>
And try this:
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');
}
};
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>
Upvotes: 6