Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate how to call another application from within FIRE app #63

Open
adrianq opened this issue Sep 6, 2017 · 1 comment
Open
Assignees
Labels

Comments

@adrianq
Copy link
Member

adrianq commented Sep 6, 2017

No description provided.

@MurhafSousli
Copy link
Contributor

One solution is to use deep linking with 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants