Force your users to update your app with using Firebase

Semih Bozdemir
3 min readJul 21, 2016

--

Mobile apps are not like web apps. People download your apps from the app stores and update them if there is a new version. They may use old version of your app anytime. Let’s say old version of your app is not functional anymore. Then, you fix that and upload your new version to store but users have not updated yet. So, they think something is wrong with your app and it sucks :(

It actually happened to me. I have an Instagram repost app which is called Rensta. It was using Instagram API to login and fetch your feed and likes. Instagram changed its API access policy, so I recode my app to make it work and upload the new version to Google Play Store. Then, some of my users did not update and complained about the app and gave one-star. :( Then, I decided to implement a force update mechanism to protect myself from bad comments like the one below.

very bad comment in Turkish :) It says that what the hell is that. It shows nothing. please fix that immediately. It was the best for me but now it is awful blabla…

To implement a force update mechanism, we can use Firebase Remote Config. But how?

Firstly, connect Firebase to your project

I suggest you to use bundled Firebase plug-in of Android Studio 2.2. It is very easy to use. You can find more information here.

Add these parameters to Remote Config server

Select Remote Config from your dashboard of project and add these parameters like the following image.

Don’t forget to change “force_update_store_url” with your store url. Otherwise, your users can download my app :)

Add these lines to your application class

We set default values in case of some parameters could not found in Remote Config Server. Our remote config parameters will be fetched every minutes by calling this method.

firebaseRemoteConfig.fetch(60)

Create a wrapper class to check whether force update is needed or not

I created a class, ForceUpdateChecker, to make it easy. It is implemented with Builder pattern as well. That makes usage simpler. We can do all work by adding one line code in the client side.

Check version update in your launcher activity

An alert dialog will be shown when application is launched if force update needed. When user selects “Update”, it redirects to the store to update app, otherwise it exits from application.

Finally, edit your parameters from the console

When you upload a new APK to the store, open your Firebase Remote Config console. Then, change “force_update_required” to true and increment “force_update_current_version”. Your parameters should be seen like the image below.

After publishing your changes, just wait a minute and relaunch your application.

And the result…

In Monitise, the company I worked, we have a lot of mobile banking application projects. Customers (banks) always want their users to use latest version of mobile app because of some law changes etc. That’s why, force update mechanism becomes an obligation for some projects.

--

--