2017-08-08 153 views
1

我正在使用ionic3中的phoneRTC创建实时音频调用应用程序。导入科尔多瓦插件

我一直在使用下面的命令

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

这增加以下行到我的package.json

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

和下面对config.xml

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

现在加入科尔多瓦插件,我不知道如何使用或在我的home.ts文件中导入。

回答

1

由于phonertc是不是你要使用这样的原生插件:

.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 

    }); 
    } 
} 

注:

如果以上方法都不行,你可以尝试在this article中解释的另一种方法(参见标题Using a Plugin Not Included in Ionic Native