0

I'm using JavaScript Google Map API and Google Direction service for my website. I successfully managed to put around 100 waypoints on the Map. Now I want to open this map on a native mobile app Android and iOS if the user opens up the page on a mobile browser.

You can check my example here

I want to open this Map as it is on a native Android and iOS app. To open it up on an Android device, I tried the following intent URI:

geo:latitude,longitude

The above intent URI does not work in my case since there are a lot of waypoints latitude and longitude and above URI can have only one.

Please help me out.

Thanks in advance.

xomena
  • 31,125
  • 6
  • 88
  • 117
Assad Ullah Ch
  • 706
  • 7
  • 12

1 Answers1

0

The recommended and supported way to open native apps is using the Google Maps URLs. The Google Maps URLs has a Directions map action where you can specify origin, destination and waypoints (the number of supported waypoints vary by the platform).

You have to generate URI in form https://www.google.com/maps/dir/?api=1&parameters according to the documentation and use it with your intents.

I hope this helps!

xomena
  • 31,125
  • 6
  • 88
  • 117
  • this does not work for me since Google Maps URLs do not support my solution. For example, passing coordinates of around 100 waypoints as a query string results in showing up on a few on the native app as well as the website. – Assad Ullah Ch Aug 04 '18 at 16:32
  • Yes, this is actually my requirement. I managed to generate 100 waypoints on the website using Google Map JavaScript API and Google direction service. I want to invoke the native mobile app with the same data (direction & waypoints) upon button tap if the user opens the page in the mobile browser. – Assad Ullah Ch Aug 04 '18 at 18:05
  • Unfortunately, no way to pass hundred waypoints. You should reduce them to supported number. – xomena Aug 05 '18 at 13:15
  • Is there any possibility to pass a JSON file path in the URL to load the data through the Mobile app? – Assad Ullah Ch Aug 06 '18 at 22:47
  • I'm not aware about such possibility. – xomena Aug 07 '18 at 08:42