Gabe O'Leary Gabe O'Leary - 6 months ago 48
TypeScript Question

Cordova InAppBrowser plugin is not installed

When I list plugins (

cordova plugin list
), it is listed there but when I run my code on an android device I get this message in the console (from chrome remote debugger):
Native: InAppBrowser is not installed or you are running on a browser. Falling back to, all instance methods will NOT work.

I have the latest version of ionic-cli.

I've included a sample project here:

I basically:

  • used the cli to "start" a tabs project

  • added a single provider (using generator)

  • added provider to one of my tabs

  • cordova plugin add cordova-plugin-inappbrowser

  • import & attempt to use

I tried removing and reinstalling using the plugin to no avail.

Any ideas for what is wrong?

Answer Source

Usage of ionic-native plugins must wait on the device being "ready"

For Ionic2 with Angular this can be achieved by importing Platform (with every thing else) to whichever component/service you plan on using the ionic-native plugin from.

import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';
import { InAppBrowser } from 'ionic-native';
import { Platform } from 'ionic-angular';

and then waiting on the platform being ready:

export class Service() {
   constructor(public platform: Platform) {
   init() {
     this.platform.ready().then(() => {
       let browser = new InAppBrowser('', '_system');
       browser.on("loadstop").subscribe(()=> console.log("loadstop"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download