Firebase remote config for create notification update

Firebase Remote Config Notification Update

Hello every one this is my first english blog, and my english is not good enough, so i hope you can understand my writing. And today i will share about how to create notification update using Firebase Remote Config.


When your android app is going to live there’s will always so much problem, the real world is not like our expectations. Android apps is not like web which we can not updates on the fly. We need to compile out code again to apk and upload to play store and then user need to update their app to get fix error on their app. But sometimes user do not know if there our application is have new update on playstore. So that way we need to make a schema the will notify out users to update their app.

Firebase Remote Config

And one of the solution is we can use Firebase Remote Config.  Basically firebase remote config is variable of config that we can change the value from firebase dashboard. With firebase remote config we can control the value of configuration in our android app from firebase. In this way will give advantages to us for manage the value of configuration inside our android app which has going live. So one of implementation that we can use Firebase Remote Config to create notification to user about new update of our app.


Now let’s get started to implement firebase remote config to our apps. First we need to create new project android connect to firebase. There’s many way to connect our project to firebase but my favorite one is using firebase plugin on Android Studio. But right now i’m not going to explain how to connect the project to the firebase please  read the firebase documentation to connect your project into firebase.

So next we need to add some dependency to our project.

implementation ''

And now add this code into activity or fragment to checking current update version of our app.

private void checkUpdate() {
    FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();

    FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()

    long cacheExpiration = 3600;
    if (mFirebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
        cacheExpiration = 0;

            .addOnCompleteListener(this, task -> {
                if (task.isSuccessful()) {
                String build_version = mFirebaseRemoteConfig.getString("build_version");
                int updatedVersion = Integer.parseInt(build_version);
                if (updatedVersion > BuildConfig.VERSION_CODE) {
                    new AlertDialog.Builder(this)
                            .setNegativeButton("Skip", (dialogInterface, i) -> {
                            .setPositiveButton("Ok", (dialog, which) -> {
                } else {
                    Log.d("Response", "checkUpdate: false");

public void openPlayStore() {
    final String appPackageName = this.getPackageName();
    try {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
    } catch (android.content.ActivityNotFoundException anfe) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("" + appPackageName)));

Setting Firebase Remote Config

Now go to Firebase Remote Config and add new parameter remote config.

Firebase Remote Config

And don’t forget to publish the changes :

And if we change the value of build_version we will get alert like this :


So the idea is we will check the build version of our app and if the updateVersion is more higher than BuildVersion we ask to user to update their app. Build version can be found on build.gradle like this.

defaultConfig {
    applicationId "com.ahmadrosid.notificationupdate"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner ""

For this sample project you can download here. And that for to day i hope you get the point. Don’t forget to share this article.

4 Replies to “Firebase remote config for create notification update

  1. Haii. Kak saya tertarik dengan beberapa artikel kakak.. Jika di izinkan bolehkah saya belajar dengan kakak secara pribadi ? Saya ingin belajar cara membuat aplikasi android, taoi sejauh ini saya masih mengalami banyak kesulitan,sebab diwilayah saya tidak ada yg mengerti masalah seperti ini,jdi mau gak mau harus otodidak,jujur otodidak itu sangat susah kak. Jadi saya mohon kepada kakak untuk membimbing saya agar saya dapat membuat aplikasi android,
    Atas perhatiannya saya ucapkan teriamaksih

Leave a Reply

Your email address will not be published. Required fields are marked *