hold your app customers updated on their units
Customers could check out new options, have entry to hurry enhancements, and reap the benefits of bug fixes after they hold your software program up to date on their units. Though some customers select to allow background updates when utilizing an unmetered connection, different customers would possibly want a reminder to take action.
Energetic customers are prompted to improve your app utilizing the in-app updates performance in Google Play Core libraries.
Units operating Android 5.0 (API stage 21) or increased are suitable with the in-app updates function.
Listed below are two strategies for displaying updates inside your app:
If the consumer desires to replace the app, a popup window will ask them. Each acceptance and denial are choices. In the event that they agree, the replace will begin downloading behind the scenes. When your replace affords a few modest UI tweaks or efficiency upgrades, make the most of this.
The consumer should replace the app with a purpose to use this full-screen UX indefinitely. You may make the most of this when you have a vital replace, comparable to a safety patch.
There are two alerts that may begin the replace:
- Precedence: You specify the replace’s significance in every launch by offering an integer that ranges from 0 to five. (5 being the very best precedence). As a way to replace the app, this may begin the suitable replace circulate (Instant or Versatile).
- Staleness: Specifies the period of time the system has been conscious that an replace is accessible. This aids in setting off the suitable circulate. As an example, the Versatile circulate could be triggered if the consumer hadn’t up to date the app within the earlier 30 days following the discharge of the replace, and the Instant circulate could be triggered if it had been longer than 90 days.
For a greater consumer expertise, you may additionally mix the 2 alerts.
Add the next dependencies to your module-level gradle.construct file.
We’re going to place all the pieces we want in a separate file to make implementation less complicated, after which we’re going to name it from the Exercise we wish to verify for updates.
The next code needs to be pasted into a brand new file known as InAppUpdate.kt
Initialize the InAppUpdate.kt class and add the strategies onResume and onActivityResults to your exercise (typically the MainActivity):
Whenever you use this code and set precedence to:
5: Immediately shows Instant (Advisable for crucial updates)
4: Shows Immediacy after 5 days and Flexibility after 3 days.
3: Shows Instant after 30 days and Versatile after 15 days (Advisable for efficiency updates)
2: Shows Immediacy after 90 days and Flexibility after 30 days (Advisable for minor updates)
1: All the time Reveals Flexibility
0: It has no impact on the replace circulate.
In fact, you’re free to switch the code to fit your necessities.
There isn’t a technique to set the replace’s precedence via the Google Play Console; as a substitute, you have to use the Google Play Developer API.
You should add your app twice to the inner (or alpha or beta) monitor with a purpose to check your in-app replace resolution.