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

Forced update show only once (explain below) #138

Open
ShravanMeena opened this issue Mar 31, 2023 · 3 comments
Open

Forced update show only once (explain below) #138

ShravanMeena opened this issue Mar 31, 2023 · 3 comments

Comments

@ShravanMeena
Copy link

ShravanMeena commented Mar 31, 2023

If the user kills the screen while the in-app-update is being downloading, the prompt to update will not show up again the next time the app is opened. next time it show shouldUpdate:false.
Anyone facing same issue if not then please retry one more time.

this is the response I am getting image

@Lepidopterolog
Copy link

@ShravanMeena An update can be already downloaded. You need just install it. Despite the fact that shouldUpdate is false, you have a versionCode field and you can compare it with a versionCode (on android) of your app and in that case they will be different.

@ShravanMeena
Copy link
Author

ShravanMeena commented Mar 31, 2023

@ShravanMeena An update can be already downloaded. You need just install it. Despite the fact that shouldUpdate is false, you have a versionCode field and you can compare it with a versionCode (on android) of your app and in that case they will be different.

No it just shows me updated version but my app current version is below.

and if already downloaded, how do I install it at the beginning of the next app @Lepidopterolog ?

@Lepidopterolog
Copy link

@ShravanMeena I just managed the same problem yesterday))

There are several flows. If you called the update and launched a new instance of the application, then 2 options are possible: 1. The update is still loading. 2. It is already loaded.
In the second case, everything is simple - install it (the library has the installUpdate method). In the first one, wait until it is pumped, and then install it.

How to determine if an update is being downloaded or already downloaded?
If you look at the Android documentation for updates, you will understand that this library does not provide all native features. As of now you need installStatus https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#installStatus()
in the answer that sends the checkNeedsUpdate method, which is not there, but that's not a problem, because it's an easy fix, unfortunately it will have to be done with a patch (I mean patch-package).

What exactly should be done? - in general, here is an example: Hilokal@5dc7471

I implemented it a little differently:

if (inAppUpdateInfo.installStatus !== AndroidInstallStatus.INSTALLED) {
	return {
		shouldUpdate: true,
		storeVersion: newAppV,
		other: { ...inAppUpdateInfo },
		reason: '...',
	}
}

And then it's all about js, everything is very simple. Checking that this is Android and one of the 2 cases:

installStatus === IAUInstallStatus.DOWNLOADED:
	inAppUpdates.installUpdate()

installStatus === IAUInstallStatus.DOWNLOADING:
	wait for it to install: inAppUpdates.addStatusUpdateListener(...)

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

No branches or pull requests

2 participants