Ionic 2プロジェクトでサードパーティのcordovaプラグインを使用する際に問題がありますが、その中にはIonic Nativeでは使用できないものがあります。私が関心を持つ限り、イオンネイティブの外にあるプラグインは、それらをインポートする必要はありません。彼らは直接利用可能です。cordovaプラグインをionicで使用するにはどうすればいいですか?
私は、ibm-mfp-core
(https://www.npmjs.com/package/ibm-mfp-core)プラグインを使用しています。すべて私はBMSClient.initialize()
メソッドを使用してIBM Bluemix SDKを初期化します。加えて、いくつかの他のビルトインがあります。しかし、どれもcordova.plugins
で利用できません。ここで
は抜粋です:
import { Component } from '@angular/core';
import { Platform, ionicBootstrap } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
import { TabsPage } from './pages/tabs/tabs';
declare let cordova:any;
@Component({
template: '<ion-nav [root]="rootPage"></ion-nav>'
})
export class MyApp {
public rootPage: any;
constructor(private platform: Platform) {
this.rootPage = TabsPage;
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
// initialize IBM BLuemix SDK
//BMSClient.initialize("https://pearl.mybluemix.net", "1a1ab2e9-4f5a-4db6-9ba3-2da97349a160");
typeof cordova.plugins.MFPCore != 'undefined'?alert('MFP found'):alert('MFP NOT found');
});
}
}
ionicBootstrap(MyApp);
返信ありがとうございました。残念ながら、上記で指摘したリソースは私を助けませんでした。それらはひどく時代遅れであり、動作しません。 プラグインの 'plugin.xml'ファイルを確認しました。プラグインが 'cordova.plugins'コレクションにバインドされていないことが判明しました。だから直接アクセス可能であったはずです。しかし、そうではありません。 – somnathbm