3

I am creating a real time audio calling app using phoneRTC in ionic3.

I have added the cordova plugin using following command

ionic cordova plugin add cordova-plugin-phonertc --save

Which adds following lines to my package.json

"cordova": {
        "plugins": {
            "com.dooble.phonertc": {}
        }
    }

and following to config.xml

<plugin name="com.dooble.phonertc" spec="~2.0.1" />

Now, i don't know how to use or import this in my home.ts file.

Sampath
  • 63,341
  • 64
  • 307
  • 441
Sid
  • 146
  • 1
  • 9

1 Answers1

3

Since phonertc is not a native plugin you have to use it like this:

.ts

declare var cordova;

@Component({
})
export class Page2 {

  constructor(public platform: Platform) {

  }

  getMyPluginInfo() {

    this.platform.ready().then(() => {//this is very important

      cordova.plugins.yourPlugin.YourPluginMethod();//replace plugin's name with this `yourPlugin` and `YourPluginMethod` with plugin's method which you want

    });
  }
}

Note:

If above method won't work you can try another method which has been explained in this article.(see it under the title Using a Plugin Not Included in Ionic Native)

Sampath
  • 63,341
  • 64
  • 307
  • 441