The more users run the latest and greatest version of your app, the better. This is no different for the parcel tracking app of Dutch postal company PostNL that we maintain and develop at Q42. Approximately every two weeks we release a new and improved version. We ship great new features, and every now and then we need to do a security patch. So far we’ve had to rely on the Play Store to notify the user about a new version, or to auto-update the app. But by using Android’s in-app updates, a Play Core library feature, we now have the ability to make users aware of important updates from within the app itself. This improves the adoption speed and reduces users missing out on bug fixes and cool features.

What are in-app updates?

The in-app updates feature of the Play Services helps you to notify users of new versions of the app. Users can easily upgrade using this notice without having to leave the app.

This mechanism has some nice benefits:

  • It can trigger users to update their apps quicker
  • The user gets informed that the app is being improved
  • Users that have disabled auto-updates will also be prompted to update

Implementing this new API is rather straightforward. Handling the user interface for prompting the user to update is also included in the Android API that Google supplies. If you want to see how to implement this, read the guide.

The PostNL app with an in-app update notification
The PostNL app with an in-app update notification

The missing part

While in-app updates seem like a very good thing to have in your app, it does come with a limitation. At the moment it is not possible to distinguish between different app updates so users will get notified of every update that is published on the Play Store.

Since we like to release often, this means it can make users feel we are asking them to update every time they open the app. To avoid this, we only want to trigger this in certain situations. Good examples of this are a major new feature, a critical bugfix or when support for a (very) old version is dropped.

At the Android Dev Summit of October 2019, Alessandro Dovis showed that the Play Store will eventually provide functionality to assign an update priority to a specific app version. In the presentation, it was said this solution would be released “very soon”. However, at the time of writing, no new information has been released about this solution yet.

The stopgap

Since we were very eager to adopt the in-app updates in the PostNL app based on priority, we created a simple solution that we can use until the Play Store provides this functionality. We already use Firebase in our app, so we’ve decided to add the version upgrade information in Firebase Remote Config.

The update JSON we put in Remote Config looks like this:

{
    "updates": [
        {
            "version": 4242,
            "updatePriority": 3
        },
        {
            "version": 3000,
            "updatePriority": 5
        }
    ]
}

Defining this information in Firebase Remote Config allows us to have full control on which update requires an in-app update prompt. We’ve tried to assume the same priority numbers that Google used in their presentation in order to choose between Flexible, Immediate and no update prompt.

The logic to determine the update priority is based on the installed version combined with the above configuration. It looks up all versions newer than the installed version and takes the highest priority of all available updates as the priority for the message to show to the user. The implementation looks like this:

fun getUpdatePriority(currentAppVersion: Int, info: UpdateInfo) : Int {
    val mostImportantUpdate = info.updates
        .filter { it.version > currentAppVersion }
        ?.sortedBy { it.updatePriority }
    return mostImportantUpdate.updatePriority ?: 0
}

The result is that the user will update based on the priority that is best suited for their version. So, if an user hasn’t updated in a while, they will be prompted with the highest priority that is registered in the versions in Firebase.

Conclusion

We are very happy with in-app updates and feel it helps our users use the latest and greatest version of our app, even with automatic updates disabled. All in all it is quite easy to implement, our solution using Firebase Remote Config provides a simple and easy to use stopgap until the Play Store gets this new priority feature per version.


Does building Android apps for PostNL, HEMA, Rijksmuseum sounds fun to you? And do you love figuring out new features like in-app updates, instant apps or Jetpack Compose? Then please do check our Android and other job vacancies (in Dutch) at https://werkenbij.q42.nl!