IONIC 6 and Capacitor: If there's an app update, how can i navigate to the store? (Android/iOS)

I’m using Ionic 6 and Capacitor 4.0.1 with Angular. I’m trying to obligate my users to update the app if there’s a new app version on the store. But i can’t see any Native api or capacitor plugin for this… only things like ‘app rate’…

i’ve solved doing the following steps:

  1. store in my db the “current supported version” items

  2. in my app, i have a currente version variable

  3. I check if the current version is valid with a backend service

  4. If it isn’t a valid version it redirects the user to the app store with the Market plugin
    this.openAppStore();

import { Market } from '@ionic-native/market/ngx';
   ...

  openAppStore() {
    let id = this.myService.isPlatformAndroid ? 'com.myapp.xxx' : 'idxxxxxxx';
    this.market.open(id);
  }
3 Likes

There is an awesome plugin for this! Check it out: GitHub - capawesome-team/capacitor-app-update: ⚡️ Capacitor plugin that assists with app updates.

3 Likes

@EinfachHans i’m testing this option and i’m having problems with it. At the moment of publish a closed alpha of the app Google Play Store told me that i can’t use this cane of permission with any app.

Blockquote We have detected that your application’s manifest file contains the REQUEST_INSTALL_PACKAGES permission. Your app will be evaluated based on the policy of the Request Package Installation permission. We recommend that you fill out the declaration form available on the Play Console.
If your app doesn’t use the Request Install Packages permission for allowed features, or you’ve stopped using this permission, you should remove it from your app’s manifest. For more information, you can watch this PolicyBytes video.

I’m 100% sure it’s because the capacitor-app-update, but i can’t find any way to solve it.

@ciccilleju also same with the ionic-native-market API… it’s something new from google since 29 septembre policy…

check you android manifest, it depends on REQUEST_INSTALL_PACKAGES and not on the plugin itself.

For what are you using REQUEST_INSTALL_PACKAGES?

it was autogenerated after being installed any of this plugins. I tried to delete that permission from Android project, but Google reject it anyways.

i’m pretty sure it’s not the market plugin. What are the other plugins you installed?

Solved. It was another native plugin from ionic, which have used the permission… thx for the attention and the quick answer!

1 Like

Very usefull plugin thanks !

Hello Folks, i have been trying to use this plugin in vuejs but i am not able to. Can you me guide on this
GitHub - capawesome-team/capacitor-app-update: ⚡️ Capacitor plugin that assists with app updates.. I have installed the package. Here is my code :

this.result = AppUpdate.getAppUpdateInfo();
console.log(AppUpdate);
console.log(“RESULT”);
console.log(this.result);
this.getCurrentAppVersion = this.result.currentVersion;
console.log(“CURRENT APP VERSION”);
console.log(this.getCurrentAppVersion);

  this.getAvailableAppVersion = this.result.availableVersion;
  console.log("AVAILABLE APP VERSION");

  console.log(this.getAvailableAppVersion);

  AppUpdate.openAppStore();

  this.getUpdateAvailability = this.result.updateAvailability;
  console.log("UPDATE APP VERSION");

  console.log(this.getUpdateAvailability);

  if (this.result.flexibleUpdateAllowed) {
    AppUpdate.startFlexibleUpdate();
  }