Skip to content

Instantly share code, notes, and snippets.

@sembozdemir
Created July 21, 2016 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sembozdemir/de95b51a779887ab7675b55129943cfb to your computer and use it in GitHub Desktop.
Save sembozdemir/de95b51a779887ab7675b55129943cfb to your computer and use it in GitHub Desktop.
SampleForceUpdate Application class
public class App extends Application {
private static final String TAG = App.class.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
// set in-app defaults
Map<String, Object> remoteConfigDefaults = new HashMap();
remoteConfigDefaults.put(ForceUpdateChecker.KEY_UPDATE_REQUIRED, false);
remoteConfigDefaults.put(ForceUpdateChecker.KEY_CURRENT_VERSION, "1.0.0");
remoteConfigDefaults.put(ForceUpdateChecker.KEY_UPDATE_URL,
"https://play.google.com/store/apps/details?id=com.sembozdemir.renstagram");
firebaseRemoteConfig.setDefaults(remoteConfigDefaults);
firebaseRemoteConfig.fetch(60) // fetch every minutes
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d(TAG, "remote config is fetched.");
firebaseRemoteConfig.activateFetched();
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment