@hardikslk
I got this working (after some research)
My dev enviroment:
Cordova CLI: 6.5.0 Ionic Framework Version: 3.0.1 Ionic CLI Version: 2.2.2 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.3.0 ios-deploy version: Not installed ios-sim version: Not installed
I started with the standard Contact page from the Tabs sample project and installed lampaa’s startUp plugin:
ionic plugin add com.lampa.startapp
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Platform } from 'ionic-angular';
export const myConst = {
blackboardApp: {
ios: {
storeUrl: 'itms-apps://itunes.apple.com/nl/app/blackboard-mobile-learn/id376413870?mt=8',
appId: 'bblearn://'
},
android: {
storeUrl: 'market://details?id=com.blackboard.android',
appId: 'com.blackboard.android'
}
}
}
@Component({
selector: 'page-contact',
templateUrl: 'contact.html'
})
export class ContactPage {
constructor(public navCtrl: NavController, public plt: Platform) {
}
openBB() {
if (this.plt.is('android')) {
let appId = myConst.blackboardApp.android.appId;
let appStarter = (window as any).startApp.set({ "package": appId });
appStarter.start(function (msg) {
console.log('starting BB app: ' + msg);
}, function (err) {
console.log('BB app not installed', err);
window.open(myConst.blackboardApp.android.storeUrl, '_system');
});
} else if (this.plt.is('ios')) {
let appId = myConst.blackboardApp.ios.appId;
let appStarter = (window as any).startApp.set(appId);
appStarter.start(function (msg) {
console.log('starting BB app: ' + msg);
}, function (err) {
console.log('BB app not installed', err);
window.open(myConst.blackboardApp.ios.storeUrl, '_system'
);
});
} else {
let msg_err = "Platform not supported";
alert(msg_err);
console.log(msg_err);
}
}
}
Hope it helps!