How to use Firebase Remote Config?

howto
firebase
firebase-remote-conf

(Shreyash) #1

There are a lot of of topics/posts on the community on how to use firebase remote config, so I thought why not create a tutorial about it! You can use firebase remote config in many ways, but in this particular tutorial, I’m going to show you how you can make your users update the app to the latest available version. So, lets get started…

Setting things up in firebase:

  • Create a new project in firebase.
  • Register your android app.
  • At the second step of registering your app, you will be provided with a file named google-services.json, simply download it and store it in a safe place. DO NOT rename the file.
  • Next, go to Remote Config option available under Grow category.
  • Then simply create a new parameter key. Here, I’m using app_version as the parameter key and 1.0.0 as the default value. Hit Add parameter.
    d141a09cb2d7837245d879a64d592b8d4f61dd17-470x131
  • And finally, hit Publish changes.
    8e904039218265d883c6d173b3a21faadc28ee0c-294x263

Components you’ll need:

  1. A Notifier
  2. A Clock
  3. A Network component
  4. Firebase Remote Config

Designer properties:

You don’t need to change anything in the designer, except the version name that has to be 1.0.0 (because we have set the default value of our parameter key to 1.0.0). But, you are free to experiment.
Edit: Now add the google-services.json file to the assets of your app.

Blocks:

The blocks are simply this much. You can modify them as per your needs.

Testing:

Now let’s test out our app.

  • So first of all, export your app.
  • Install it.
  • Then go to your firebase console -> Remote Config and then change the default value of your parameter key to something different than your actual version name.
  • Open your app installed on your phone.
  • If it shows the “Update” dialog, then you have done everything correctly and if it doesn’t, it’s time to check everything out.

F.A.Q.

  1. Why my app isn’t compiling? :frowning:
    Ans. You need to have the same packagename in firebase as in the creator. Also you need the latest version of google-services.json to get a working compile.

  2. Why should I use Remote Config to make users update the app when I can also use Firebase DB?
    Ans. Though both of them can be used to do this, Remote Config is much more reliable than Firebase DB in this case because Firebase actual work is to store data.

    So this much for now. Let me know if you haven’t understood ant step or if you have any questions/problems.


(David Ningthoujam) #2

Thanks a lot. :wink:


(tomer) #3

Where do I download the file: google-services.json?


(Yusuf Cihan) #4

In your Firebase Console.


(tomer) #5

Yes, but where?


(Shreyash) #6

:point_up_2:


(TECH WORLD) #7

thanks for this tutorial


(tomer) #8

I did not find it. Can you take a picture for me?


(Shreyash) #9

First click this button to register your app:



Then at the second step of registering your app you’ll be provided with a option to download the file:


(tomer) #10

Thanks, I understand


(Franck G) #11

Thanks for the guide !
But when i update the value, i must wait few hours (like one entire night) for the value to be updated.
The value is fetch at each launch, but it still have the same value after changing it on firebase.

image


image

EDIT : If i clear the cache and the storage of the app, it’s updating the value

EDIT : I give up, firebase remote config has too much problems, i will use database instead


(Androteq) #12

Does it works in android phones below android 7.
I tried, but it works in only android 7+ phones


(Franck G) #13

Even on Android 9, i need to clear all my app data :confused:
Use Firebase DB for the moment


(David Ningthoujam) #14

you need to set the cache expiration time according to your needs.


(Shreyash) #15

@Franck_G28
Sorry, because of some reasons I can’t actually explain the whole stuff. But don’t worry, below I’m listing two blogs which will help for sure.


PS: Let me know if the issue persist.