Skip to main content
For what release control does and how to set rules in the dashboard, read Release control.

Setup

Release control is on by default once Lerix.initialize() runs, with the built-in screens. To change it, pass appControl:
MyApplication.kt

Google Play in-app updates

usePlayInAppUpdate needs Play’s in-app update library in your app. The SDK doesn’t bundle it, so add it yourself:
app/build.gradle.kts
Without the library, or for apps not installed from Google Play, Update opens the store link as usual.

Version

The SDK sends versionName as the version and versionCode as the build number, and the package name so Lerix can build the Google Play link. Rules compare build numbers when both sides have one.

Instant changes with silent push

When you start or end a maintenance window or force an update, Lerix sends a silent FCM data message so apps in the background refresh too. It reaches apps with push notifications set up, and the SDK handles it for you: it is never shown as a notification. Without push, apps pick up the change at their next check.

Built-in screens

  • Maintenance: a full-screen activity over your app, with a Try again button. Back sends the app to the background; it never returns into the app. If another of your activities comes to the front, the screen comes back on top.
  • Required update: the same full-screen host, with release notes and an Update button.
  • Update prompt: a dialog on the current activity with Update, Later and, when allowed, Skip this version. Back closes it without saving Later.
The SDK declares its activity through manifest merging, so there’s nothing to add to your AndroidManifest.xml. Buttons follow the device language (English, or Arabic right to left). See Custom UI for when each one appears.

Your own screens

Set ui = false, then collect Lerix.appControl.state, a StateFlow<LerixAppControlState>. The state has update (LerixAppUpdate), maintenance (LerixMaintenance) and sdk (LerixSdkControl), each null when nothing applies (fields in The state). Lerix.appControl.currentState reads it once.
MainActivity.kt
Outside a coroutine, use a listener. It is called on the main thread:
The helpers drive the buttons:
Pass the current activity to openStore so Play’s in-app update can start from it. Without one, the SDK uses the activity in the foreground.

Check now

Lerix.appControl.refresh() is a suspend function that ignores the saved answer’s lifetime, fetches, and returns the new state. refresh(callback) does the same from Java-style code. The SDK already checks on launch, when the app returns to the foreground, and every minute during an emergency (see Delivery and offline behaviour).