Hi Todd, thanks for replying.
I was actually about to reply myself.
I debugged the obfuscated calls and looked at the logic.
You are right, it works as coded but not as described in the docs.
The problem is that this whole workflow - for me - is a mess!
The docs say that fetch(xxxx) gets fresh values.
That is not true.
Not even when I start the app, not even when I reboot the phone!
If fetch() does not guarantee me fresh values then what is the point in calling it myself?
This should be changed to a config setting that I can set once and know that after some time I am guaranteed fresh values by the FirebaseRemoteConfig object.
The FirebaseRemoteConfig handles the schedule and the fetch because ideally I should not care about the fetching and the schedule itself,
and in reality the fetch() is not guaranteed to do anything!
Why should I be burdened to call fetch() if I am going to be throttled and returned stale cached values instead?
Then, where in the docs is the throttling behaviour described?
What is the minimum cache expiration? (it seems that making it too small makes fetch() fail).
How many fetch() calls am I allowed before I get throttled?
Are the number of allowed calls to fetch affected by my expiration period?
When is my throttling going to end?
These are important details to make a real-life app that are missing and should be stressed since they pose so many restrictions on usage.
The sample app/code in the docs is way too simple and inadequate.
Fetching on create... If I rotate it will fetch again.
Of course it works because dev=true.
If you switch it off then all bets are off.
It will all depend on how I implemented the fetch() calling process and if I fall into the throttling pit.
Will the user trigger too many fetches?
I need to thing about that!
For me if fetch() returns success then I see no reason for activateFetched() to return false and not apply the values.
if fetch() is throttled or not allowed it should fail with the reason and not return success.
Also all over the docs it is portrayed that all you need to do is cal getXXXX() to get the latest value.
It is not true.
You also need to call fetch() (for freshness but that is not guaranteed)
As a developer since I'll prefer the latest value I will probably bundle fetch() with getXXX() - same as the sample.
But then this will work only every hour!
In an Android App's lifetime an hour is eternity - if you have a long running service then it might still be alive...
I can probably start/stop an app in an hour 10s of times.
They will all get stale values.
So the workflow is:
*) call fetch on startup or every hour in a schedule - or go crazy call freely and be throttled/regulated - end result is the same!
*) if the config changes server side, the app will get the new values after about the 1hr mark (max) - according to the sample's timeout period.
For me the intro videos for Firebase config are a bit misleading.
I got the impression it is more dynamic than it really is - I guess that is my bad.
But docs need a lot more info for fetching/caching/throttling.
And since there is a requirement to throttle/regulate calls to the back-end (to not kill google's servers), fetch should be done for us by specifying the expiration as a config thing.
Or at least make it an option to have the fetch done for us.
This way at least I only need to call getXXXX().
Anyway, lesson is learnt...
Sorry about the rant...
It is not by any means directed towards you and thanks again for taking the time to reply