LaunchNavigator Ionic2 plugin not installed

I am new to Ionic 2 and all around. I'm trying to set up my first mobile application: by clicking a button, I will open my own navigation (for example, Google Maps for Android). I installed the launchnavigator plugin:

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

and inside the 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) ); } } 

build npm run build and upload it to IonicView using ionic upload . I do everything as suggested in this link , but with different luck.

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

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

Where is my mistake?

+6
source share
3 answers

New answer, something is wrong with your project. Have you changed the index.html file? Does it still include cordova.js? If so, which version of Ionic and Cordova are you using?

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

Was there an entry on the iOS screen: https://giphy.com/gifs/xTiN0EEQV82aIXWnQI Just captured the image on Android, but it works the same way: Android pic

Try the project from github.

+2
source

Cordova plugins need only be called once the platform is ready.

 constructor(public navCtrl: NavController,public platform:Platform) {//inject in constructor } 

In your navigate() function

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

The reason for your error is that you are using Ionic View. Your Ionic app is just html, css and javascript. However, any plugins you use are written in Java for Android and Objective-C for iOS. This plugin source code is then compiled into your application for each platform.

With Ionic View, it only downloads your application, html, css and javascript. Nothing made up. Ionic View is an application and it downloads your code. Thus, no plugins that you have are included. Ionic View has some plugins installed on it, and you can see this list here: https://docs.ionic.io/tools/view/#supported-plugins

Unfortunately, you cannot test any plug-in that is not included in this list without creating and deploying it on a device or emulator.

+1
source

Source: https://habr.com/ru/post/1015108/


All Articles