Giter VIP home page Giter VIP logo

capacitor-app-update's Introduction

⚠️ Deprecated repository

This project has been moved to the following monorepo: capawesome-team/capacitor-plugins.



App Update

@capawesome/capacitor-app-update

Capacitor plugin that assists with app updates.


This plugin supports retrieving app update information on Android and iOS.
Additionally, this plugin supports in-app updates on Android.

Maintainers

Maintainer GitHub Social
Robin Genz robingenz @robin_genz

Sponsors

This is an MIT-licensed open source project. It can grow thanks to the support by these awesome people. If you'd like to join them, please read more here.

Installation

npm install @capawesome/capacitor-app-update
npx cap sync

Android Variables

This plugin will use the following project variables (defined in your app’s variables.gradle file):

  • $androidPlayCore version of com.google.android.play:core (default: 1.9.0)
  • $androidPlayServicesBaseVersion version of com.google.android.gms:play-services-base (default: 18.0.1)

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Usage

import { AppUpdate } from '@capawesome/capacitor-app-update';

const getCurrentAppVersion = async () => {
  const result = await AppUpdate.getAppUpdateInfo();
  return result.currentVersion;
};

const getAvailableAppVersion = async () => {
  const result = await AppUpdate.getAppUpdateInfo();
  return result.availableVersion;
};

const openAppStore = async () => {
  await AppUpdate.openAppStore();
};

const performImmediateUpdate = async () => {
  const result = await AppUpdate.getAppUpdateInfo();
  if (result.updateAvailability !== AppUpdateAvailability.UPDATE_AVAILABLE) {
    return;
  }
  if (result.immediateUpdateAllowed) {
    await AppUpdate.performImmediateUpdate();
  }
};

const startFlexibleUpdate = async () => {
  const result = await AppUpdate.getAppUpdateInfo();
  if (result.updateAvailability !== AppUpdateAvailability.UPDATE_AVAILABLE) {
    return;
  }
  if (result.flexibleUpdateAllowed) {
    await AppUpdate.startFlexibleUpdate();
  }
};

const completeFlexibleUpdate = async () => {
  await AppUpdate.completeFlexibleUpdate();
};

API

getAppUpdateInfo(...)

getAppUpdateInfo(options?: GetAppUpdateInfoOptions | undefined) => Promise<AppUpdateInfo>

Returns app update informations.

Only available for Android and iOS.

Param Type
options GetAppUpdateInfoOptions

Returns: Promise<AppUpdateInfo>


openAppStore(...)

openAppStore(options?: OpenAppStoreOptions | undefined) => Promise<void>

Opens the app store entry of the app in the Play Store (Android) or App Store (iOS).

Only available for Android and iOS.

Param Type
options OpenAppStoreOptions

performImmediateUpdate()

performImmediateUpdate() => Promise<AppUpdateResult>

Performs an immediate in-app update.

Only available for Android.

Returns: Promise<AppUpdateResult>


startFlexibleUpdate()

startFlexibleUpdate() => Promise<AppUpdateResult>

Starts a flexible in-app update.

Only available for Android.

Returns: Promise<AppUpdateResult>


completeFlexibleUpdate()

completeFlexibleUpdate() => Promise<void>

Completes a flexible in-app update by restarting the app.

Only available for Android.


addListener('onFlexibleUpdateStateChange', ...)

addListener(eventName: 'onFlexibleUpdateStateChange', listenerFunc: (state: FlexibleUpdateState) => void) => PluginListenerHandle

Adds a flexbile in-app update state change listener.

Only available for Android.

Param Type
eventName 'onFlexibleUpdateStateChange'
listenerFunc (state: FlexibleUpdateState) => void

Returns: PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.


Interfaces

AppUpdateInfo

Prop Type Description
currentVersion string Version code (Android) or CFBundleShortVersionString (iOS) of the currently installed app version. Only available for Android and iOS.
availableVersion string Version code (Android) or CFBundleShortVersionString (iOS) of the update. Only available for Android and iOS.
availableVersionReleaseDate string Release date of the update in ISO 8601 (UTC) format. Only available for iOS.
updateAvailability AppUpdateAvailability The app update availability. Only available for Android and iOS.
updatePriority number In-app update priority for this update, as defined by the developer in the Google Play Developer API. Only available for Android.
immediateUpdateAllowed boolean true if an immediate update is allowed, otherwise false. Only available for Android.
flexibleUpdateAllowed boolean true if a flexible update is allowed, otherwise false. Only available for Android.
clientVersionStalenessDays number Number of days since the Google Play Store app on the user's device has learnt about an available update if an update is available or in progress. Only available for Android.
installStatus FlexibleUpdateInstallStatus Flexible in-app update install status. Only available for Android.
minimumOsVersion string The minimum version of the operating system required for the app to run in iOS. Only available for iOS.

GetAppUpdateInfoOptions

Prop Type Description
country string The two-letter country code for the store you want to search. See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes. Only available for iOS.

OpenAppStoreOptions

Prop Type Description
country string The two-letter country code for the store you want to search. See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes. Only available for iOS.

AppUpdateResult

Prop Type
code AppUpdateResultCode

PluginListenerHandle

Prop Type
remove () => Promise<void>

FlexibleUpdateState

Prop Type Description
installStatus FlexibleUpdateInstallStatus Flexible in-app update install status.
bytesDownloaded number Returns the number of bytes downloaded so far. undefined if the install status is other than DOWNLOADING.
totalBytesToDownload number Returns the total number of bytes to be downloaded for this update. undefined if the install status is other than DOWNLOADING.

Enums

AppUpdateAvailability

Members Value
UNKNOWN 0
UPDATE_NOT_AVAILABLE 1
UPDATE_AVAILABLE 2
UPDATE_IN_PROGRESS 3

FlexibleUpdateInstallStatus

Members Value
UNKNOWN 0
PENDING 1
DOWNLOADING 2
INSTALLING 3
INSTALLED 4
FAILED 5
CANCELED 6
DOWNLOADED 11

AppUpdateResultCode

Members Value Description
OK 0 The user has accepted the update.
CANCELED 1 The user has denied or cancelled the update.
FAILED 2 Some other error prevented either the user from providing consent or the update to proceed.
NOT_AVAILABLE 3 No update available.
NOT_ALLOWED 4 Update type not allowed.
INFO_MISSING 5 App update info missing. You must call getAppUpdateInfo() before requesting an update.

Test with internal app-sharing

The Android Developers documentation describes how to test in-app updates using internal app sharing: https://developer.android.com/guide/playcore/in-app-updates/test

Changelog

See CHANGELOG.md.

License

See LICENSE.

capacitor-app-update's People

Contributors

balbertho avatar dependabot[bot] avatar matyas-igor avatar robingenz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

capacitor-app-update's Issues

bug: FlexibleUpdate never notifies the onFlexibleUpdateStateChange

Describe the bug
Hi, thanks for you plugin.
In Android using FlexibleUpdate option, it happens that the method handleOnActivityResult, deletes the Listener when handling the activity result, therefore the Listener never notifies the onFlexibleUpdateStateChange.

To Reproduce
Fragment implemented on javascript file:

const appUpdateInfo = await AppUpdate.getAppUpdateInfo();
if (appUpdateInfo.updateAvailability === AppUpdateAvailability.UPDATE_AVAILABLE) {
   if (appUpdateInfo.flexibleUpdateAllowed) {     
      AppUpdate.addListener('onFlexibleUpdateStateChange', (state) => {
        console.log('Update State: ', state);
      });    
      let activityResult = await AppUpdate.startFlexibleUpdate()
   }
}
  1. Go to AppUpdate.java, method handleOnActivityResult, after RESULT_OK, happen this:
  2. Method handleOnActivityResult
  3. After resultCode == RESULT_OK, begins to download
  4. Error, deletes the listener while downloading occurs:
if (requestCode == REQUEST_FLEXIBLE_UPDATE) {
   this.appUpdateManager.unregisterListener(this.listener);
   this.listener = null;
}

Expected behavior
It may be more convenient for the listener to be removed from the javascript file when a definitive status is reported.

Smartphone information:

  • Device: [e.g. iPhone6]
  • OS: [Android 7.0]
  • Browser [Chrome]
  • Version [92.0.4515.159]

feat: Does it support updating applications from custom source addresses

Is your feature request related to a problem? Please describe.
Google play is not required to update the application from a custom source address.
Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

bug: updateAvailability is 1 (UPDATE_NOT_AVAILABLE)

Plugin version:
1.3.1

Platform(s):

  • Android

Current behavior:
I'm not sure if this is a bug or a wrong implementation. I'm trying to test the app update using Google Test in-app updates.

I have uploaded a version with a higher versionCode and nothing happens, my implementation didn't fire the custom alert.

After, and just for testing purposes, I uploaded a new version to open an alert and see what is the AppInfo returning. The updateAvailability is 1 (UPDATE_NOT_AVAILABLE).

  1. Notice how updateAvailability is 1.
  2. Notice that currentVersion is higher than availableVersion. The availableVersion that shows the image (5100142) is very very old in my history, I don't know where and why that value was returned.

As a third attempt, I have uploaded a new version with a higher versionCode and versionName, and, same result as before. The availableVersion is still 5100142.

I don't understand what is happening.

Also, the question that comes to my mind is:

  • Should I rely on appUpdateInfo.updateAvailability === AppUpdateAvailability.UPDATE_AVAILABLE or I need to convert currentVersion and availableVersion to numbers and compare them?

Example:

const current = +currentVersion;
const newest = +availableVersion;
const updateIsAvailable: boolean = newest > current;
  • With my Android v12 test device, the immediate and flexible flows are both false. Why? Perhaps this flows are just available if the App is in production?

Expected behavior:
updateAvailability should be 2 if there is an update.

Related code:
This is my implementation:

    AppUpdate.getAppUpdateInfo()
      .then(info => {
        if (info.updateAvailability === AppUpdateAvailability.UPDATE_AVAILABLE) {
          // There is an update available
        }
      });
  }

Additional information:
I don't know if this is a bug or something about Google Internal Testing thing.

Capacitor doctor:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 3.6.0
  @capacitor/core: 3.6.0
  @capacitor/android: 3.6.0
  @capacitor/ios: 3.6.0

Installed Dependencies:

  @capacitor/cli: 3.6.0
  @capacitor/core: 3.6.0
  @capacitor/android: 3.6.0
  @capacitor/ios: 3.6.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

bug:

Plugin version:
2.0

Platform(s):
Android

Current behavior:
Does not build

Expected behavior:
Plugin to build

Steps to reproduce:
Create Ionic App with react, install your plugin and try to build for android

Related code:

insert short code snippets here

Other information:
Here is a screenshot of the error I get
image

Capacitor doctor:

npx cap doctor
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.1.0
  @capacitor/core: 4.1.0
  @capacitor/android: 4.1.0
  @capacitor/ios: 4.1.0

Installed Dependencies:

  @capacitor/cli: 3.7.0
  @capacitor/android: 3.7.0
  @capacitor/core: 3.7.0
  @capacitor/ios: 3.7.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

bug: Unregistered Play Core listener should not be null

Plugin version:
1.3.0

Platform(s):
Android

Current behavior:
Catch a crash in Firebase Crashlytics
AppUpdatePlugin.java line 169
dev.robingenz.capacitor.appupdate.AppUpdatePlugin.handleOnActivityResult

Some of logs

Caused by java.lang.NullPointerException: Unregistered Play Core listener should not be null.
       at com.google.android.play.core.internal.aw.d(:7)
       at com.google.android.play.core.listener.b.g(:13)
       at com.google.android.play.core.appupdate.e.unregisterListener(:3)
       at dev.robingenz.capacitor.appupdate.AppUpdatePlugin.handleOnActivityResult(AppUpdatePlugin.java:169)
       at com.getcapacitor.Bridge.onActivityResult(Bridge.java:1017)
       at com.getcapacitor.BridgeActivity.onActivityResult(BridgeActivity.java:215)
       at android.app.Activity.dispatchActivityResult(Activity.java:8320)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5198)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4529)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4582)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:181)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:102)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2235)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:240)
       at android.app.ActivityThread.main(ActivityThread.java:7829)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1027)

Other information:
Device Brand: OPPO
Model: CPH2185
Operating System Version: Android 10

Capacitor doctor:

@capacitor/cli: 3.3.3
@capacitor/android: 3.3.3
@capacitor/core: 3.3.3
@capacitor/ios: 3.3.3

feat: Obtain version name of an app that is live in the PlayStore

Hi, is it possible to obtain the version name of an android app that is live on the play store? Since the version code can be obtained using the attribute 'availableVersion' from AppUpdateInfo, I was wondering whether it's possible to get the version name.

By the way by version name I mean the version that is displayed to the user, for example 22.1011.2

Exposing AppUpdateInfo.installStatus() method

Greetings, a request to expose installStatus() method in AppUdateInfo as it let us know whether a flexible update has install pending. It is really important to handle the negative cases of a flexible update. Please look into it

below is the pseudo code from official docs:

// If the update is downloaded but not installed,
// notify the user to complete the update.
if (appUpdateInfo.installStatus() == InstallStatus.DOWNLOADED) {
popupSnackbarForCompleteUpdate();
}

feat(ios): return `minOsVersion`

I don't believe this library considers the minimum OS version for iOS when reporting updates available. Is that something that added?

bug: Capacitor 4 no work

Plugin version:
Last version

Platform(s):
Any

Hello,

I have been testing the plugin and it seems not to work correctly with capacitor 4, the app closes directly

E/AndroidRuntime: FATAL EXCEPTION: pool-12-thread-1 Process: com.josexs.ct, PID: 6505 java.lang.IllegalArgumentException: com.josexs.ct: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:375) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645) at android.app.PendingIntent.getBroadcast(PendingIntent.java:632) at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:174) at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108) at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86) at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920) E/cr_VariationsSeedLoader: Failed loading variations seed. Variations disabled.

a greeting

bug: Updates dont work

Describe the bug
Try to use plugin

To Reproduce
All steps by readme

import { AppUpdate } from "@robingenz/capacitor-app-update";
const performImmediateUpdate = async () => {
  const result = await AppUpdate.getAppUpdateInfo();
  alert(JSON.stringify(result, null, 4));
  const anotherResutl = await AppUpdate.performImmediateUpdate();
  alert(JSON.stringify(anotherResutl, null, 4));
};

Expected behavior
Window with update

Screenshots
photo_2021-07-26_13-44-29

Smartphone (please complete the following information):

  • Android Emulator Pixel 4
  • Android 11 API 30

Additional context

  • Plugin version: 1.0.0-alpha.3
  • Capacitor version: 3
  • androidPlayCore = '1.10.0'

Question regarding v1.3.1

Had a question; is version v1.3.1 still compatible with capacitor v3? Our app is still on version 3, so we can't make the jump to version 4 of capacitor-app-update

bug: Fuzzy google error message on Android devices

Plugin version:

  • 2.0.1

Platform(s) & Device(s):

  • Android ( Emulator )

Frameworks:

  • Ionic 6
  • Capacitor 4
  • Angular 14

Current behavior:

I'm trying fetch app informations like the code bellow.

async onAppLaunch() {
  const appInfo = await AppUpdate.getAppUpdateInfo();
  
  const current = appInfo.currentVersion;
  const latest = appInfo.availableVersion;
}

getAppUpdateInfo() throwing me this (google) error:

Install Error(-6): The download/install is not allowed, due to the current device state (e.g. low battery, low disk space, ...). (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_INSTALL_NOT_ALLOWED)

After some research, my issue was fixed by using a device with google play and connecting an account to it, like explain here (stackoverflow).

Expected behavior:

Check if the device is connected to google play and throw an understandable error message if not. Like this many young capacitor developers like me will save time ❤️

Capacitor doctor:

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 4.6.1
  @capacitor/core: 4.6.1
  @capacitor/android: 4.6.1
  @capacitor/ios: 4.6.1

Installed Dependencies:

  @capacitor/cli: 4.2.0
  @capacitor/android: 4.2.0
  @capacitor/core: 4.2.0
  @capacitor/ios: 4.2.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

[Question] Does this only look at prod listings

Hello,

I've tried to locate this information within the documents available and within the issues and been unsuccessful.

I think I already know the answer, but I'd like confirmation to ensure It is what I think and not a bug/misconfig.

Question, does this only support/look at production store listing on Android/iOS. I have an app which is still in development and therefore isn't yet available in prod - only TestFlight & Open Beta tracks.

When running locally, I encounter the following console error message
Required app information could not be fetched

Tom

feat: add `removeAllListeners` method

Is your feature request related to a problem? Please describe.
There is currently no way to remove all event listeners.

Describe the solution you'd like
Add a new method removeAllListeners.

Example: https://github.com/robingenz/capacitor-screen-orientation#removealllisteners

You have to edit 2 files:

Android - cannot return correct available version

Hi, thanks for your great work with this plugin.

I'm using version 1.3.0 with capacitor 3.3.3 for 2 android apps. In both cases the available version of my app returned by this code:

AppUpdate.getAppUpdateInfo().then(appUpdateInfo => {
      this.appUpdateInfo = appUpdateInfo;
      console.warn('app update info is ', this.appUpdateInfo)
    })

is not the latest version but an older version. The only thing noticeable about the version that is returned is that it was running Android SDK 29, all versions after this were changed to use Android SDK 30.

I can't see any way to find the logic that is used to get the available version (I assume this is in com.google.android.play:core which I'm using the latest version of 1.10.2). I've tried clearing the Google Play cache on the phone, checking the countries the app is available for, making sure there are no previous versions active in other tracks etc).

My apps are running on Google Play (one in open testing and one in production) and I can update them via Google Play when I push app updates (i.e. the play store recognises that updates are available and allows me to manually install them). I cannot figure out why the plugin does not see the latest version but only a specific older one?!

Example app: app.scafol.io.staging

Shown on the phone using this plugin:
WIN_20211221_09_30_21_Pro

Versions available in Google Play:
image

Any pointers for resolving this would be greatly appreciated!
thanks
Marcus

feat: App Gallery Support

Is your feature request related to a problem? Please describe.
The plugin currently works with App Store & Google Play but not App Gallery (Huawei)

Describe the solution you'd like
Can the plugin support when opening the Store?

Describe alternatives you've considered
An alternative that I'm considering would be to use App.canOpenUrl({ url: "com.huawei.appmarket" }) to detect if the device falls within App Gallery range and open the store somehow

feat: Receive versionName instead/alongside versionCode on Android

Is your feature request related to a problem? Please describe.
We are using semantic versioning of our app and we would like to use that to determine if we need to notify the user about a new version or to force update.
Currently on android it returns versionCode and no versionName.

getAppUpdateInfo() returns availableVersion as string on iOS (example: "2.5.2") and integer on Android. (example: 7475)

Describe the solution you'd like
I would like to receive availableVersion as versionName on android or at least have it as a separate available property

Describe alternatives you've considered
We considered using versionCode but its a problem keeping track of updates between android / iOS.

Thank you for your work & answers

How to test startFlexibleUpdate()

Hi, very nice plugin, thanks for helping the community.

I'm receiving code 3 (UPDATE_NOT_AVAILABLE ) on startFlexibleUpdate() in an Android Device while testing. For testing purposes I have downgraded the debug version to 99521, while the production version in app store is v 99522. I received the error and I saw no modal, I believe this happened because the .keystore is not the same or some other form of debug x production issue. Am I right? Is there a way to test it without going into production? Thanks in advance.

image

AppStore country information is required.

I tried to check why am I can't get the version from our app through the SOURCE for iOS you wrote.
As a result, when searching for information by bundleID in itunes, we found that the search criteria did not include countries. Of course, if it's the USA, it won't be a big problem, but for certain apps, you can target specific countries and distribute them. That's the case with the apps we've built.
To solve this problem, we would like you to put a condition to add the country name to the part to check the update information.

An example is below.

ex)
https://itunes.apple.com/lookup?bundleId=org.nerdfriends.ddoit.app => No results found.

https://itunes.apple.com/lookup?bundleId=org.nerdfriends.ddoit.app&country=kr => The search results are checked.

feat:

I am supporting an application with capacitor 2. Is there any compatibility with this version?

Exposing client Staleness property in AppUpdateInfo

It would be nice if the plugin exposes the Client Staleness value so that the host app can decide to show felxible update / immediate update .

I know there is a priority for the same , but i feel this value can also be used in case the users are using an older version of the app.

bug: error while trying to get appUpdateInfo

Capacitor Doctor

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 3.1.2
  @capacitor/core: 3.1.2
  @capacitor/android: 3.1.2
  @capacitor/ios: 3.1.2

Installed Dependencies:

  @capacitor/cli: 3.1.1
  @capacitor/android: 3.1.1
  @capacitor/core: 3.1.1
  @capacitor/ios: 3.1.1

[success] iOS looking great! 👌
[success] Android looking great! 👌

I was trying this plugin (^1.0.0-alpha.3) with the latest version of Capacitor v3 and when trying to call the AppUpdate.getAppUpdateInfo() I get the following error message:

{message: "Required app information could not be fetched", errorMessage: "Required app information could not be fetched"}

followed by
Error: Uncaught (in promise): Error: Required app information could not be fetched i@capacitor://localhost/main-es2015.8ff1e5aae7b0a67b0188.js:1:670532

Expected behavior
I expect to get information about app/play store updates and the current version of the application

Smartphone (please complete the following information):

iPhone 12 simulator

updates not available

Hi,

First thanks for your great & useful work.
I'm sure this is not a bug but more likely a noob question:

My app. is available on both the app store & play store.
I call AppUpdate.getAppUpdateInfo()

  1. on IOS: the returned currentVersion is not the latest (1.2), but the previous one (1.1).
    I opened https://itunes.apple.com/lookup?bundleId=xxx to check, and the latest 1.2 is in the result, so I don't understand why the plugin doesn't find it. Any idea?

  2. on Android: I always get availableVersion: "0"
    I test from Android Studio, but from the store it doesn't seem to find the latest version too.
    I don't have any "$androidPlayCore version of com.google.android.play:core" in variables.gradle, but have no idea about what it means and how to implement it (sorry, I told you it was a noob question)

Thanks for your help

Support for country URL param

Hi, thanks a lot for making this cool plugin!

I noticed that in scenarios when the app is not in available in a country, the lookup API URL doesn't work in that case and returns an empty JSON, which makes sense. In order to get a response in this case, the plugin can allow users to chose to pass an argument to an optional country parameter in getAppUpdateInfo and openAppStore methods. I'm happy to send in a PR if this addition makes sense.

iOS Issue: Required app information could not be fetched

The plugin returns the information as expected in Android build but we are seeing an error on iOS (real device and simulator)

AppUpdate.getAppUpdateInfo: message: "Required app information could not be fetched"
Error: Uncaught (in promise): Error: Required app information could not be fetched CapacitorException@capacitor://localhost/vendor.js:1500:10

Code below

import {  AppUpdate, AppUpdateInfo } from '@capawesome/capacitor-app-update';

public appUpdateInfo: AppUpdateInfo | undefined;

 ngOnInit() {

      AppUpdate.getAppUpdateInfo().then(appUpdateInfo => {
            this.appUpdateInfo = appUpdateInfo;
            if( this.appUpdateInfo.updateAvailability === 2){
              this.openAppStore();
            }
          });

}

type: question

Wanted to ask that after performing immediate update Why you're not resolving the PluginCall...And...In the function ready for update at line 189

Isn't it problematic. You're stating Update Not available if update is available....

if (this.appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
            ret.put("code", this.UPDATE_NOT_AVAILABLE);
            call.resolve(ret);
            return false;
}

bug:

image

in android you use ret.put("currentVersion", String.valueOf(pInfo.versionCode));

but it not version of app - it's build number

bug:

Plugin version:
v2.0.0

Platform(s):
Adroid

Current behavior:
After calling 'performImmediateUpdate ' or 'startFlexibleUpdate' and 'completeFlexibleUpdate ' the dialog to update the app is shown, the download and installation progress is shown but at the end nothing happens. The App remains without updating.

Expected behavior:
The app is updated to the latest version available on Google Play Store

Capacitor doctor:

Latest Dependencies:

  @capacitor/cli: 4.4.0
  @capacitor/core: 4.4.0
  @capacitor/android: 4.4.0
  @capacitor/ios: 4.4.0

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 4.4.0
  @capacitor/core: 4.4.0
  @capacitor/android: 4.4.0

[success] Android looking great! 👌```

bug: app crash when clicked on No Thanks in flexible update

Plugin version:
1.3.0

Platform(s):
Android - Observed on Android 10 and 11

Current behavior:
when the user taps on No Thanks , when flexible update popup is shown , the app crashes , i dont think it is happening all the time but we could reproduce it majority of the times.

Here's the crash report

java.lang.RuntimeException:
at android.app.ActivityThread.deliverResults (ActivityThread.java:5579)
at android.app.ActivityThread.handleSendResult (ActivityThread.java:5620)
at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2325)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8633)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Caused by: java.lang.NullPointerException:
at com.google.android.play.core.internal.aw.a (Unknown Source:7)
at com.google.android.play.core.listener.b.b (Unknown Source:14)
at com.google.android.play.core.appupdate.e.unregisterListener (Unknown Source:3)
at dev.robingenz.capacitor.appupdate.AppUpdatePlugin.handleOnActivityResult (AppUpdatePlugin.java:169)
at com.getcapacitor.Bridge.onActivityResult (Bridge.java:1010)
at com.getcapacitor.BridgeActivity.onActivityResult (BridgeActivity.java:215)
at android.app.Activity.dispatchActivityResult (Activity.java:8550)
at android.app.ActivityThread.deliverResults (ActivityThread.java:5572)

Expected behavior:
The popup should just dismiss.

Steps to reproduce:
just tap on No Thanks in the flexible app update and you receive a crash.

Related code:

insert short code snippets here

Other information:

Capacitor doctor:

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 3.4.0
@capacitor/core: 3.4.0
@capacitor/android: 3.4.0
@capacitor/ios: 3.4.0

Installed Dependencies:

@capacitor/cli: 3.2.5
@capacitor/core: 3.2.5
@capacitor/android: 3.2.4
@capacitor/ios: 2.5.0

hello 👋

just to say thanks, your plugin is awesome 👏, just implemented it without any headache.

I see you follow lots of @capacitor-community best practices and was just wondering why not move your repo over there? you could reach a higher audience and more peeps from community helping you with maintenance, new features, etc. just an idea, if you want I can assist you over migration.

Thank you again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.