Mobile App
#
29 March, 2017

Remote Config with Firebase

Remote-Config-with-Firebase

 

As an android app developer, it was very peculiar to do Client – Server communication before Firebase. Now, with the help of Firebase, all this became very comfortable for us.

Firebase provides many features like Analytics, Authentication, Real Time Database, Storage, Notification, Dynamic Links, Crash Reporting, Invites, Test lab, Remote config, App Indexing and Admob.

Using remote config user can modify android app without new production of android app development.

In Firebase, Remote Config defines parameters in our app and update their values in the cloud, allowing us to modify the appearance and behavior of our app without distributing an app update.

Remote Config Integration:

Step 1 :

  • First it needs to create project on https://console.firebase.google.com/.
  • Click on create new project. After creating new project click on Add Firebase to your android app.
    image1
  • Add Package name and SHA-1 for Project with Following Command. You can generate debug SHA-1 Key
  • For Mac/Ubuntu:
    1
  • For Windows:
    2image 2
  • Download Config file
    From here, you can download google service.json file and add that google service.json file into your project at app level. Then press continue.image 3
  • Add Firebase SDK
    Open your project level build.gradle file and add this line under buildScript->Dependenciesclasspath 'com.google.gms:google-services:3.0.0'
    Open your app level build.gradle file and add this line at the bottom of file
    apply plugin: 'com.google.gms.google-services’
    Then press ‘ sync now ’ which is displayed in your IDE.

Step 2 :

  • First add the dependency of remote config in your app level build.gradle file.compile 'com.google.firebase:firebase-config:10.2.0'
  • Get remote config singleton object using below line in your MainActivity.java file.
    3

Step 3 :

  • Set default parameter valuesWe have to create one xml directory under res folder and create remote_config_default.xml file in xml directory in which remote config default parameter value is available. Directory flow should be
    res->xml->remote_config_default.xml
  • Remote_config_default.xml
    4And simply add below line in your MainActivity.java to integrate default remote config value in you project.mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_default);

Step 4 :

  • Creates fetch() request to fetch values from the Remote Config Server and callsactivateFetched() to make those values available to the app. Add below method in your MainActivity.java file.
    5In this project user use to fetch remote config data in onClick of OK button.
    Here is the code for MainAcivity.java and activity_main.xml file
  • MainActivity.java :
    6
  • Activity_main.xml
    7

Step 5 :

  • Run your project into your device. In this device It looks likefarebase android rpi.jpg

Step 6 :

  • Open your project into Firebase Console. Click on remote config and add parameter and its value. Here the user have used two parameters and its added value isMy_message : This is remote config testing
    My_message_color : #d6142e
  • Don’t forget to publish value (Click on publish in remote config firebase console) after adding or updating your remote config parameter.
    image5

Step 7 :

  • After adding this value, click on OK button for fetching values using remote config and then you will get the value of parameter which is defined in firebase remote config console. Check out this image below.farebase android

We’ve seen what 9series can do with Firebase Remote Config and how to execute it into our application to start modifying the look & feel and behavior of our application remotely.

Being a top Firebase android application development companies New York, we have experienced team with extensive knowledge in making mobile applications using Firebase platform.

 

Categories

Archives