Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suggest users to update Android app with Google Play (Google In-App Update Support)

I saw this dialog always appears when I open old version of Tokopedia app. Tokopedia suggests me to update the app.

enter image description here

The dialog gives me two methods to update the app:

  • Update now
  • Update when Wi-Fi available

If I select Lain Kali (Cancel), the dialog appears again on the next app open. But, if I select the second option, I open Play Store and see this behavior:

enter image description here

It really do update on background until my device is connected to Wi-Fi.

I want to mimic the same action like Tokopedia did, because some version of my app contains critical bug. I want to give users a better user experience.

Do you know how to show the dialog above?

like image 264
Anggrayudi H Avatar asked Nov 19 '25 23:11

Anggrayudi H


2 Answers

This is possible using In-App Update provided by Google.

In-app updates works only with devices running Android 5.0 (API level 21) or higher, and requires you to use Play Core library 1.5.0 or higher. There are two types - 1.Flexible and 2. Immediate.

Follow this link and implement In-App Update as per your requirement.

https://developer.android.com/guide/app-bundle/in-app-updates

like image 121
Anupam Avatar answered Nov 22 '25 14:11

Anupam


You can achieve this by using Support in-app updates

  • It only work from Android 5.0 (API level 21) or higher.

  • There are two types of Update Available with UX for in-app updates:

    • Flexible
    • Immediate

To Check for update availability

// Creates instance of the manager.
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);

// Returns an intent object that you use to check for an update.
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

// Checks that the platform will allow the specified type of update.
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
    if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
          // For a flexible update, use AppUpdateType.FLEXIBLE
          && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
              // Request the update.
    }
});
like image 45
Nikunj Avatar answered Nov 22 '25 13:11

Nikunj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!