👨🏼‍💻 How Do You Update Your App Without Releasing an Update?

Besir Karaoglu
Huawei Developers
Published in
3 min readNov 22, 2022
Header Image

Introduction

Hello,

I always wondered how apps change their features like app layout or behaviors. But it took me a while to realize that i really wanted to learn it and use it on my apps. So i did what it takes and i found out there is an AGC SDK called Remote Configuration. After integrating AGC SDK, various questions appeared in my mind. What if i use Firebase SDK? Would it be different? Is it easy or much harder? After a short research and learning process, i can say it is quite easy to do and i will show you how. In this article, i will show you how to use Remote Configuration in your app and what are the differences between Firebase SDK and AGC SDK.

About the Libraries

In the docs’ words,
Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update.
Remote Configuration of AppGallery Connect allows you to change the behavior and appearance of your app online without requiring users to update the app. With the service, you can provide tailored experiences for your users in a timely manner.

Coding

For the sake of simplicity, we will skip some of the integration steps. If you need more detailed information, you can follow the links under the References title.

1. Adding the Parameters

AGC Console: Select Project>Select App>Grow>Remote Configuration>New Parameter

AGC Console Remote Config Add Parameter

Firebase Console: Select Project>Build>Remote Config>Add Parameter

Firebase Console Remote Config Add Parameter

2. Integrating the SDK

In App-level build.gradle file

For the AGC SDK, add this code block to your Application.

When you use AGC SDK, you need to set your app’s information before using the SDK. You can find these on your app’s agconnect-services.json file or AGC Console>Project Settings>General Information.

3. Adding Code

To operate Remote Config, we need to get an instance.

Then, we need to set default values in case of fetch from the server fails or takes too long. You can set default values using a Map or .xml file. We will use Map for this article.

And lastly, we are fetching data and using it on our app.

As we can see from the code, there are only small differences between them. If we want to go through them:
1. When we use Firebase we set the fetch interval value before we call the fetch function. But when we use AGC, we set the fetch interval value inside the fetch function.
2. While we call apply() manually on AGC, Firebase has a function for both fetching and activating the value. If you want to do it separately, you can call fetch() and activate().

Note: If an app fetches too many times in a short time period, fetch calls are throttled. If you are not in the developing phase, you should not set a fetch interval value. The default value is 12 hours for both SDKs.

Conclusion

In this article, we went through the Remote Configuration and use it on our app with Firebase SDK and AGC SDK. Although they were developed by completely different companies, they are too similar and good to use. To get to know more about SDKs or examine the source code on GitHub you can check below.

Good day, see you in the next articles :)

References

--

--