Google Play / ANDROID
In-app updates
Offer a background download or a full-screen update flow, with the lifecycle code in a reusable component.
Before you start
- An Android app configured for Google Play distribution and a suitable test account.
- A registered Activity Result launcher before the Activity reaches STARTED.
- An eligible newer version with the expected package and signing identity for update testing.
Connect the component
Choose the mode
Select In-app updates in Components, then choose Flexible or Immediate. The source, initialization example and setup guide follow that selection. Both modes use the default component name GooglePlayInAppUpdate.
Generate the component
Choose Kotlin or Java, a target Android module, package and class name. Inspect the proposed files and dependency changes before applying.
Connect Activity lifecycle
Register the result launcher early. Flexible mode registers and unregisters its download listener, checks downloaded state on resume and exposes completion for your restart action. Immediate mode resumes an interrupted developer-triggered flow from onResume.
Test through the Play flow
Sync Gradle, connect cancellation and error handling to your UI, and follow the official Play testing procedure. A debug APK installed locally is not proof that the app is eligible for an update.
What initialization looks like
These excerpts use the generated component’s public methods. Import your component and merge the calls into the lifecycle and callbacks shown in its generated guide.
// Flexible mode · initialization excerpt
val updates = GooglePlayInAppUpdate(applicationContext)
updates.register {
// Offer an app-owned "Restart to update" action.
}
updates.checkAndStart(
updateLauncher,
onUnavailable = { /* Continue the app flow. */ },
onFailure = { error -> /* Handle the error. */ }
)
// Unregister the listener when the Activity stops.
updates.unregister()// Flexible mode · initialization excerpt
GooglePlayInAppUpdate updates =
new GooglePlayInAppUpdate(getApplicationContext());
updates.register(() -> {
// Offer an app-owned "Restart to update" action.
});
updates.checkAndStart(updateLauncher,
() -> { /* Continue the app flow. */ },
error -> { /* Handle the error. */ });
// Unregister the listener when the Activity stops.
updates.unregister();The excerpt shows Flexible mode. Select Immediate in the plugin for its full-screen flow and interrupted-update resume example. Lifecycle methods belong in their respective Activity callbacks, not consecutively in one method.
INTEGRATION NOTES
- Google Play controls update availability. The plugin cannot force an update to become available.
- The launcher and callbacks in these excerpts belong to your app. The generated entry example shows where to register them.
- Switching the mode does not migrate or overwrite an existing customized component.
Keep the official references close.
GooglePlay API maintains the component template. The SDK behavior and service requirements are defined by the provider.