2017-08-08 5 views
1

Ich erstelle eine Echtzeit-Audio-App mit PhoneRTC in ionic3.Importieren des Cordova-Plugins

Ich habe das cordova Plugin folgenden Befehl hinzugefügt

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

Welche folgenden Zeilen zu meinem package.json fügt

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

und nach

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

Jetzt config.xml Ich weiß nicht, wie ich das in meiner home.ts Datei verwende oder importiere.

Antwort

1

Da phonertc ist kein nativer Plugin Sie es wie folgt verwenden müssen:

.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 

    }); 
    } 
} 

Hinweis:

Wenn obige Methode werden Sie nicht arbeiten kann ein anderes Verfahren ausprobieren, das in this article erläutert wurde (siehe unter dem Titel Using a Plugin Not Included in Ionic Native)

Verwandte Themen