A quick How-To covering this useful feature

Sanoj Punchihewa
Jul 16 · 2 min read

Ever found yourself working all night fixing a bug or adding a groundbreaking feature to your Android app, only to find that just a few of users actually update their apps? Not to worry, Android have now released a new feature called in-app updates, where you can prompt the user to update the app.

source: https://developer.android.com/guide/app-bundle/in-app-updates

Although some users enable background updates when their device is connected to an unmetered connection, other users may need to be reminded to update. In-app updates is a Play Core library feature that introduces a new request flow to prompt active users to update your app.


As an Android developer, it was tiring adding all this code to my apps! So I developed a library which implements the in-app update feature, cutting the whole thing down to five lines of code.

Let’s get started!


Photo by Nicole Wolf on Unsplash

Step 1: Add jitpack to your root level build.gradle, at the end of repositories.

Step 2: Add the dependency to app level build.gradle.

Step 3: Initialize the UpdateManager in your onCreate method of the activity.

There are two update modes — Flexible and Immediate:

  • Flexible(UpdateManagerConstant.FLEXIBLE) (default) — User can use the app during update download, and installation. Restart needs to be triggered by user.
  • Immediate (UpdateManagerConstant.IMMEDIATE)— User will be blocked until download and installation is finished. Restart is triggered automatically.

Step 4: Call continueUpdate method in your onResume method to install waiting updates:

You can find all the above codes in the demo app, check it outif you want to get a head start!

Photo by Vasily Koloda on Unsplash

That’s it! Now you have in-app updates in your android app.


Github repository: https://github.com/SanojPunchihewa/InAppUpdater

Demo App: https://github.com/SanojPunchihewa/InAppUpdater/tree/master/app

Better Programming

Advice for programmers.

Sanoj Punchihewa

Written by

Computer Engineering Undergraduate | UoP | Android Developer

Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade