dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 129 forks source link

isAppAvailable function issue #242

Closed ronnygtas closed 3 years ago

ronnygtas commented 4 years ago

I am using Ionic 4 and when i don´t have an installed app (in this case Waze) the app send me to the play store to download waze, after downloading it i return to my app and click again on navigate to start waze navigation but it send me to the store again, the isAppAvailable function keeps sending me false even when the app is installed.

Here is some of my code:

This is my html:

  <ion-col class="center" size="4" (click)="continue(this.launchNav.APP.GOOGLE_MAPS)">
    <img class="navegar-icono" src="../../../../assets/images/icon-map.jpg"/>
  </ion-col>
  <ion-col class="center" size="4" (click)="continue(this.launchNav.APP.WAZE)">
    <img class="navegar-icono" src="../../../../assets/images/icon-waze.jpg"/>
  </ion-col>
  <ion-col class="center" size="4" (click)="continue(this.launchNav.APP.UBER)">
    <img class="navegar-icono" src="../../../../assets/images/icon-uber.jpg"/>
  </ion-col>

this is my ts:

continue(tipo: any) { console.log('Tipo App ', tipo); this.launchNav.isAppAvailable(tipo).then(res => { console.log('Respuesta App Disponible ', res); if (res === true) { this.tipoApp = tipo; let options: LaunchNavigatorOptions = { start: "", app: tipo };

    this.launchNav.navigate([this.latitud, this.longitud], options)
    .then(success => {
      console.log('Success Launcher', success);
    }, error => {
      console.log('Error Launcher', error);
    });
  } else {
    if (tipo === 'uber') {
      this.market.open('com.ubercab');
    } else if (tipo === 'waze') {
      this.market.open('com.waze');
    } else if (tipo === 'google_maps') {
      this.market.open('com.google.android.apps.maps');
    }
  }
});

}

this is my enviroment:

Ionic:

Ionic CLI : 5.4.13 (C:\Users\artur\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.11.9 @angular-devkit/build-angular : 0.801.3 @angular-devkit/schematics : 8.1.3 @angular/cli : 8.1.3 @ionic/angular-toolkit : 2.1.2

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 8.1.0, browser 6.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 17 other plugins)

Utility:

cordova-res (update available: 0.10.0) : 0.8.1 native-run : 0.3.0

System:

Android SDK Tools : 26.1.1 (C:\Android\android-sdk) NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe) npm : 6.13.4 OS : Windows 10

dpa99c commented 4 years ago

I'm guessing this is because your app was paused to the background while installing Waze from the Play Store, so when it resumed, the plugin's cached list of supported apps was stale - currently the plugin only discovers which supported apps are available when the app starts.

The solution will be to get the plugin to refresh its list of supported apps when resuming from the background, so the list is kept up-to-date. It's probably also a good idea to expose the native function which discovers supported apps as a plugin API function that you can also manually call directly.

Added to my TODO list.

reinaldoaguiar82 commented 4 years ago

Hello. I have this problem for IOS. After I updated the version of launch Navegation, my APP no longer finds Waze and Google Maps on the IOS system. for android keeps working.

do we have a solution to this problem?