- Android 5.0 or higher
- Google Play Store active
- Google Play Services active
When this method returns UPDATE_AVAILABLE, your app is ready to use the following methods to prompt the user for update.
Starts a flexible update process and prompts the user with a dialog to download the new version now or when Wi-Fi is available. The success callback from this method can be triggered more than once according to its status.
If the user does not install the downloaded flexible update:
- When app is minimized and reactivated: snackbar to install is shown thanks to the plugin’s onResume method.
- When app is closed and restarted: nothing happens. In this case, you should call getUpdateAvailability and it will return DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS. With this information, you are ready to either:
- Call updateFlexible to show again the snackbar with the RESTART button
- Call updateImmediate to install now the downloaded update (recommended)
Starts an immediate update process and prompts the user with a fullscreen dialog to download now or when Wi-Fi is available. The update is downloaded and installed in the foreground, preventing the user from interacting with your app until the installation succeeds and the app is automatically restarted.
Sets the label and the button text for the snackbar shown after downloading a flexible update. You are free to call this method at any time. You can also call it again to show different snackbar messages after the snackbar was shown.
If not called, default messages in English will be shown.
- onSuccess = “SUCCESS”
- onFail = Internal error description.
Testing Demo App
- Disable automatic app updates from Play Store’s Settings panel.
- Join the app’s open testing program.
- Install latest version from the Play Store and do not open the app.
- Close the Play Store app.
- Manually uninstall the latest version that you just installed.
- Install a previous APK version from the Download section below.
- Open the demo app and check for updates. You should get the UPDATE_AVAILABLE success callback message.
- If you get UPDATE_NOT_AVAILABLE, wait between 12 to 24 hs and retry. This is because Play Services seem to keep a server-side cache of updates checking.
Download demo app
- Download Play Store-signed APK v1.3.4 (minSdkVersion 22; AndroidX; recommended)
- Download Play Store-signed APK v1.1.9 (minSdkVersion 19; Legacy Android libraries)
- Download www source code
Demo app versions in Play Store
- 1.3.5 minSdkVersion=22; built with plugin 2.x
- 1.2.0 minSdkVersion=18; built with plugin 1.x
Testing In-App Updates plugin in your app
Easy mode + pseudo APK update
This testing method can be used with any release track, such as Production. It is good for testing purposes because the downloaded APK won’t be installed due to a signature mismatch between the preinstalled one and the one from the Store.
- Install from the Store the current version of your app.
- Uninstall it manually (not from inside the Store)
- Compile your app with a lower versioncode than the one available in the Store.
- Install the signed production app.
- Check for updates normally.
- Both Flexible and Immediate update process will take place normally.
- Replacing the installed APK with the downloaded one will fail due to a signature mismatch.
- The normal install process will end and you will return to the same test app you had installed.
- You can keep testing different update scenarios without actually having the new version installed, while the update flow takes place normally.
To keep track of the complete update process in the background, debug the update process using DDMS.
Easy + real APK update
This mode involves the following procedure:
- Upload first version to the Play Store in the Internal testing track.
- Upload the second version to the Play Store in the same track.
- Add the target user(s) to the Internal testing program Testers email list.
- Join the testing program with the invite link.
- From the App bundle explorer in Play Developers Console, download the Signed, universal APK for the first version.
- Install this Play Console-Signed APK in phone / emulator.
- Run this signed APK and check for updates normally. The updates process should work and install the second version from the Play Store because the signatures match.
By the book mode
You can use the Internal app sharing method to test in-app updates as suggested by the official Android developers guide.
Use the comments section here for demo app-related issues, and the GitHub issues tracker for plugin-related ones.