ohh2ahh / AppAvailability

This Cordova / PhoneGap plugin allows you to check if an app is installed.
229 stars 116 forks source link

TypeError: Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["cordova"]) is not a function. #57

Open eisenheim94 opened 5 years ago

eisenheim94 commented 5 years ago

Hi! I'm trying to open Gmail app, but looks like there are issue with native code.

My TS:

  openGmail(threadId, fromEmail) {
    let app;

    console.log('openGmail pressed');
    if (this.platform.is('ios')) {
      app = 'googlegmail://';
    } else if (this.platform.is('android')) {
      app = 'com.google.android.gm';
    }

    console.log('looking for app' + app);

    this.appAvailability.check(app)
      .then(
        (yes: boolean) => {
          console.log(app + ' is available')
          // const browser = this.iab.create('googlegmail://' + fromEmail + '?ui=2&#sent/' + threadId, '_system');
        },
        (no: boolean) => {
          console.log(app + ' is NOT available')
          // const browser = this.iab.create('https://mail.google.com/mail/b/' + fromEmail + '?ui=2&#sent/' + threadId, '_system');
        }
      );

    console.log('looking for twitter');

    this.appAvailability.check('twitter://')
      .then(
        (yes: boolean) => {
          console.log('Twitter is available')
          const browser = this.iab.create('twitter://', '_system');
        },
        (no: boolean) => {
          console.log('Twitter is NOT available')
        }
      );
    // https://mail.google.com/mail/b/demyd.ganenko@lifeisgoodlabs.com?ui=2&#sent/169dd829f7874210
    // let browser = new InAppBrowser('url', '_system'); //For system browser, you'll be prompt to choose your browser if you have more than one
  }

But in Xcode log I don't see anything after this.appAvailability.check(app):

2019-04-11 18:11:22.042089+0300 M3[3784:606869] openGmail pressed
2019-04-11 18:11:22.042195+0300 M3[3784:606869] looking for appgooglegmail://

In browser on desktop I see next error after click:

TS error in browser console