Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaunchNavigator Ionic2 plugin is not installed

I am new to Ionic 2 and everything around. I'm tryng to setup my first mobile app: touching a button I would open native navigation (Google Maps for Android, for instance). I've installed launchnavigator plugin:

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

and inside cremony.ts page:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';

@Component({
  selector: 'page-ceremony',
  templateUrl: 'ceremony.html'
})
export class Ceremony {

  constructor(public navCtrl: NavController) {

  }

  navigate() {
    let options: LaunchNavigatorOptions = {
      start: ""
    };

    LaunchNavigator.navigate("London, UK", options)
      .then(
      success => alert('Launched navigator'),
      error => alert('Error launching navigator: ' + error)
      );
  }
}

make a build npm run buildand upload it to IonicView with ionic upload. I've do everything like suggested in this link but with different luck.

But when I click the button (a simple <button ion-button (click)="navigate()">Navigate</button> in the ceremony.html) in the Ionic View an error say: Error launghing navigator: plugin_not_installed.

I inspected the project, the plugins directory contains uk.co.workingedge.phonegap.plugin.launchnavigatorlooks directory. So I look at package.json and config.xml and I've added the value uk.co.workingedge.phonegap.plugin.launchnavigator in the cordovaPlugins and tag <plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="~3.2.1" /> in the widget root. npm run build, ionic upload but nothing changed.

Where is my error?

like image 345
BAD_SEED Avatar asked Feb 19 '17 23:02

BAD_SEED


Video Answer


1 Answers

New answer, there is something wrong with your project. Have you modified your index.html file? Is it still including cordova.js? If so what version of Ionic and Cordova are you using?

I made this sample application with your exact code and it works perfectly on both iOS and ANdroid: https://github.com/roblouie/navigator-plugin-test

Did a screen recording on iOS: https://giphy.com/gifs/xTiN0EEQV82aIXWnQI Just grabbed an image on Android, but it works the same: Android Pic

Please try the project from github.

like image 135
Rob Louie Avatar answered Oct 13 '22 01:10

Rob Louie