Open navigation app to navigate to adress

Hi,

How can I say that the app has to open a navigation app and find a adress?

I did found this github repo
https://github.com/dpa99c/phonegap-launch-navigator

but I dont know how to use this in my ionic 2 application

Martijn Bakker

Super simple way to do it:

let destination = latitude + ',' + longitude;

if(this.platform.is('ios')){
	window.open('maps://?q=' + destination, '_system');
} else {
	let label = encodeURI('My Label');
	window.open('geo:0,0?q=' + destination + '(' + label + ')', '_system');
}

Will open Google Maps on Android, Apple Maps on iOS. Make sure In App Browser plugin is installed.

15 Likes

I’ve 3 navigation apps installed on my Iphone:

  • Google Maps
  • Apple Maps
  • Waze

I want when I click on the button that he gives me the option wich application do you want to bring you to (for example amsterdam Central Station)?

This is exactly what v3 of phonegap-launch-navigator allows you to do.

And the usage is simple: install it

ionic plugin add uk.co.workingedge.phonegap.plugin.launchnavigator

Use it:

launchnavigator.navigate("London, UK");

By default it will give you the selection behaviour you are looking for.

Question: I’ve been trying for a while now to get this launchnavigator plugin to work in Ionic 2.0.0.rc.0 but to no avail.

I’ve tried using it via the Ionic native plugin and the plugin straight up by it’s self but nothing works…

Any tips?
Much appreciated!

I’ve added a new Ionic 2 project to the example repo which uses Ionic Native to invoke the plugin: https://github.com/dpa99c/phonegap-launch-navigator-example/tree/master/Ionic2Example

2 Likes

Dude you’re awesome! Thank you very much. I’m sure a lot of people will really appreciate this!

Works Perfectly!!! :slight_smile:

Hi, I want to open my navigator in my app but it says:
index.html error launching navigator:plugin_not_installed

I installed the plugin from ionic docs and I showed in my mobile Iphone 6 whith Ionic View.
Thanks

@dpa99c1:

Is it possible for you to make a ionic 3 updated example?

It’s here: https://github.com/dpa99c/phonegap-launch-navigator-example/tree/master/Ionic3Example

Thank you so much for the fast response! I’ll check it out!

May this video help you

1 Like

I’ve tried this in my app. Works fine thank you :slight_smile:

Just a little change 2019 XD

let direction = this.proposal.proposal_state.proposal.job_request.lat+",";
    direction += this.proposal.proposal_state.proposal.job_request.long;
    if(this.plt.is('ios')){
      this.iab.create( "maps://?q="+direction, "_system");
    }else{
      this.iab.create( "https://www.google.com/maps/search/"+direction, "_system");
    }

If this helps someone :smiley:

Very Helpful, works perfectly for me on both platform android and ios. I can also directly pass address instead of lat, lng. Thank you

Great. Is it possible to specify ‘walking’ directions? Thank you.

Sorry, I found the answer: on iOS and Mac add the flag &dirflg=w on Android use mode=w

thank you very much! :slight_smile: