0

I am working with Firebase Remote Config. I have read the docs but I am confused about fetch() method in docs that is written

Remote Config caches values locally after the first successful fetch. By default the cache expires after 12 hours, but you can change the cache expiration for a specific fetch by passing the desired cache expiration to the fetch method.

I want to know if I update value from console does it automatically update my local value on the device or do I have to call fetch() method to update local values I am confused about this will I get updated values by calling FirebaseRemoteConfig.getInstance().get() if I never call fetch(). method after 12 hours does it update automatically?

Neeraj Sewani
  • 3,952
  • 6
  • 38
  • 55
Mateen Chaudhry
  • 631
  • 12
  • 32

1 Answers1

4

You will have to call fetch in your app to get the latest values from the server. Without a call to fetch your app will continue to use the values it got the last time.

The documentation bit you quoted is trying to explain that the values will be retrieved at most every 12 hours, even when your apps call fetch more frequently than that.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Thanks! that helped one thing more please i cant not fetch values form service because `addOnCompleteListener(this)` listener taking the activity context can i `fetch()` values from service context? – Mateen Chaudhry Apr 24 '18 at 14:05
  • There is also an `addOnCompleteListener` that doesn't require an `Activity`. Using that just means that your listener is not associated with an activity lifecycle, which sounds like the right approach for a listener that is not in an actvity. – Frank van Puffelen Apr 24 '18 at 14:23
  • i got it Thanks it helped :) – Mateen Chaudhry Apr 24 '18 at 14:24