Working with Firebase Remote Config for Android

In this post we will be covering how to use Firebase Remote config for Android application. Follow this tutorial for basic setup to use Firebase related service in your project.

Use Case

Remote config is useful when you want to make some changes in your app but do want to user to download updated apk. The easy solution to this is creating remote config which you can update and it will get updated on devices.

For example you are using a free server to store your data. At some point of time it was closed, so your users will not able to access that data. Here you can make server url as remote config and when current server address changes you just have to push new url in remote config. All of your users will be now pointed to new server url.




Lets start coding

In this sample application we will be using 2 parameters as remote config. These parameters will be added to server and then published. When your app starts we will fetch these parameters and this way latest data will be available to the user.

Follow this tutorial for setting up Firebase for android.

Next you have to add a dependency in app level build.gradle . Add highlighted dependency for using Remote config.

For using remote config you have to create a xml file which will contain default values which will be shipped with the device. So no value is fetched from server then these values from xml will be used.


Here we will create get a instance of FirebaseRemoteConfig and then default are loaded into it using xml file we created earlier. We will call fetchRemoteConfig() which will initialize the fetching process.

Fresh data is displayed when it is successfully fetched from the server.

Please comment for any clarification.


Technology enthusiast. Loves to tinker with things. Always trying to create something wonderful using technology. Loves coding for Android, Raspberry pi, Arduino , Opencv and much more.

You may also like...