Android Question Remote Config - Values do not Update

ashton293

Member
Licensed User
Longtime User
I am having similar issues to Desof post #16 in original thread - which does not appear to have been answered.

I use the same B4a code as originally posted under FirebaseRemoteConfig, I have copied Manifest from the original B4a page, I have set up Remote Config for the app in Firebase.

When I try to run on a real device i get the same "loading_phrase" before "fetching" as I do after "fetching". Then when I change the value in Firebase to yet another value it still doesn't change the response.

This occurs after the Fetch is said to be a "Success".

When testing the problem, I found the original phrase didn't change either - so I deleted the whole app and reloaded, At that point I could change the original loading phrase - again the same before and after the "fetch".

I have tried both the FirebaseRemoteConfig and RemoteConfig libraries.

I have attached the code I have used, the Manifest page from B4a, and the Filtered Log [my unfiltered logs are full of processes occurring on my tablet]..

Can someone please assist me with:

a] how to overcome this problem;

b] if I wanted to load several values from Firebase at the same time how can that be achieved?

Thank you for your assistance.
 

Attachments

  • Remote Config1.pdf
    96.1 KB · Views: 256

ashton293

Member
Licensed User
Longtime User
I am aware that in the example I posted I have used getValue in lieu of getString. Neither approach worked for me.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I have attached the code I have used
This is NOT the correct way. What if I would like to try the project to help?
Do you really expect me to create a new project from it (from the PDF)??

If you want to show the project using then you should use File->Export as zip from the IDE and upload this ZIP here.

Another way is to use the code tags and posting all relevant code

This time i´ll not ignore this request

Do you have configured RemoteConfig in Firebase correctly?

RemoteConfig001.png


b] if I wanted to load several values from Firebase at the same time how can that be achieved?
Add more Values in the config...

RemoteConfig002.png


Note that you TTL value is relevant.
B4X:
    cfg.fetch(86400)
You´ll get new values after the time is over. to test you can use 0 but that is not the expected value...
With a ttl of 0 you always request online values.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    cfg.Initialize("Config")  
    cfg.Defaults(CreateMap("promo_code": "", "loading_phrase": "Hallo world!"))
    Log("loading_phrase="&cfg.getString("loading_phrase"))
    Log("promo_code="&cfg.getString("promo_code"))
    Log("Fetching")
    cfg.fetch(0)
  
End Sub

Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub Config_onFetchComplete(success As Boolean)
    Log($"Config_onFetchComplete(${success})"$)
    If success Then
        Log("Activate fetched values")
        cfg.activateFetched
        Log("loading_phrase="&cfg.getString("loading_phrase"))
      
        Dim info As RemoteConfigValue = cfg.getValue("loading_phrase")
        Log($"Loading phrase info: Source ${info.Source}, ${info.asString}"$)

        Dim info As RemoteConfigValue = cfg.getValue("promo_code")
        Log($"Promocode info: Source ${info.Source}, ${info.asString}"$)

    End If
  
End Sub

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
loading_phrase=DonManfred presents
promo_code=
Fetching
** Activity (main) Resume **
Fetch Succeeded
lib:Raising.. config_onfetchcomplete()
Config_onFetchComplete(true)
Activate fetched values
loading_phrase=DonManfred presents
Loading phrase info: Source 2, DonManfred presents
Promocode info: Source 2, PROMO17
** Activity (main) Pause, UserClosed = false **
 
Last edited:
Upvote 0
Top