Open adrianq opened 7 years ago
One solution is to use deep linking with window.open()
window.open()
import { Component } from '@angular/core'; 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-some', templateUrl: 'some-page.html' }) export class SomePage { 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); } } }
source
One solution is to use deep linking with
window.open()
source