I have implemented the cordova app using angular frame work.please guide me to launch the google map or map application by passing the longitude and langtitude.
Asked
Active
Viewed 4,180 times
2 Answers
7
If you want the app open InAppBrowser:
var url = 'http://www.google.com/maps/place/' + latitude ',' + longtitude;
var inAppBrowser = window.open(url, '_blank', 'location=yes');
If you want open native Google Map app:
window.location = 'comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic'
If you want open a Map app default on user phone:
window.location = 'geo:40.765819,-73.975866'
You can find more detail in there: Android Phonegap - How to Open Native Google Maps Application
And can find more url scheme of Google Map here: https://developers.google.com/maps/documentation/ios-sdk/urlscheme#display_directions
-
very thanks and help full.. i have a doubt how to conditionally check the above scenarios.. i want to open the native app as default if it not there obviously i need to open in the App brower.. 2) other doubt is what is the difference between Google map App and Default Map app.. 3)i need to pass the lat and long and open navigation view as default. – Shamil Mar 25 '16 at 14:00
-
tell me about the default one ?? @SLyHuy – Shamil Mar 25 '16 at 14:57
-
Some user don't like google map, they install another map app, like browser. We call it default map app. – SLyHuy Apr 01 '16 at 10:00
1
I think you can do it with an specific intent like this:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);

Jerassi Ferrer
- 284
- 2
- 8