How to open the Google Maps app installed in monaca

Asked 2 years ago, Updated 2 years ago, 72 views

Monaca is developing a hybrid app that supports both Android and IOS.
When I press the link, I want to pass the coordinates of the current location and destination so that the Google Maps installed can be opened, and the Google Maps navigation system can be executed with the coordinates given.
Now

window.open('http://maps.google.com/maps?saddr='+start'
  + '&daddr='+end+'&directionmode=driving', '_system');

I'm using this kind of code like this.On Android, when you press the link and the code above moves, you will see a dialog asking if you want to connect to the Internet or connect to the Google Maps app installed.However, IOS is having trouble connecting Google Maps using safari.
How can I open Google Maps with both Android and IOS?

javascript monaca jquery html5 cordova

2022-09-29 21:46

1 Answers

For iOS, use comgooglemaps:// instead of http:// to open it in the Googlemaps app.Please refer to Google's official documentation.
https://developers.google.com/maps/documentation/ios/urlscheme

However, I cannot open it well on Android, so I think I will use monaca.isIOS() or monaca.isAndroid() to branch the process.


2022-09-29 21:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.