Launch Google Maps application, passing latitude and longitude from Ionic app?


#1

Hello,
I am a new to Ionic. I have done some google search but I am still a bit confused.

From my android Ionic app I would like to launch the google map application passing latitude and longitude so that the user can then navigate to the place.

Is is possible? Any help is very appreciated.

Thanks in advance,

Fabio


#2

You may either use the ngcordova geolocation plugin or use the google javascript api v3 straight. Here is a link for the ngcordova plugin http://ngcordova.com/docs/plugins/geolocation/


#3

Hi, thanks for your reply. What I am really searching for is a way lo launch the Google Maps application passing latitude and longitude (don’t need to display the maps within the Ionic app)


#4

Hi,

You can create a link using geo intent and provide lat and lon coordinates. Optionally an address.

window.open(‘geo:lat,lon?q=address’, ‘_system’);

Make sure you whitelist geo:* in your config.xml


#7

@fabioi Did you get it working?


#8

Hi Tom, sorry for the delay, I have been away sometime. Thanks very much It worked like a charm


#9

@fabioi: I need to work on something like what you have done. Could you please share your code where you open google maps in ionic app? Would really help.

Regards
@tashiwangdi


#10

@tomkuipers: I tried your instructions. when I run ionic serve , it tries to open a new browser window as expected. But on the mobile it does not do anything. What could I have been missing. I also added geo:* under whitelist in config.xml.