Using IBM Bluemix Mobile service cordova plugin in Ionic 2

I am having trouble using third party cordova plugin in Ionic 2 project some of which are not available in Ionic Native. As far as I am concern, the plugins which are outside of Ionic Native, I dont need to import them. They are available directly.

I am using ibm-mfp-core (https://www.npmjs.com/package/ibm-mfp-core) plugin. All I want to use BMSClient.initialize() method to initialize IBM Bluemix SDK. Plus there are some other built-in. But none of them are available in cordova.plugins.

Here’s the snippet :

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);

Did you solve this? Maybe it’s important to use the new bms plugins instead of the old mfp plugins?

We did want to use the bluemix push notifications for our ionic1 app but we failed since all the docs force to work with xCode or Android Studio…

The correct way to do this is to declare BMSClient at the top of your app.

declare var BMSClient: any;
@Component({...})

...

constructor (){
  platform.ready().then(() => {
    // you get it here
   BMSClient.initialize();
});
}
1 Like