本文整理汇总了Java中com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java FirebaseRemoteConfig.getInstance方法的具体用法?Java FirebaseRemoteConfig.getInstance怎么用?Java FirebaseRemoteConfig.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.firebase.remoteconfig.FirebaseRemoteConfig
的用法示例。
在下文中一共展示了FirebaseRemoteConfig.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pluginInitialize
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
@Override
protected void pluginInitialize() {
Log.d(TAG, "Starting Firebase Remote Config plugin");
this.firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
String filename = preferences.getString("FirebaseRemoteConfigDefaults", "");
if (filename.isEmpty()) {
// always call setDefaults in order to avoid exception
// https://github.com/firebase/quickstart-android/issues/291
this.firebaseRemoteConfig.setDefaults(Collections.<String, Object>emptyMap());
} else {
Context ctx = cordova.getActivity().getApplicationContext();
int resourceId = ctx.getResources().getIdentifier(filename, "xml", ctx.getPackageName());
this.firebaseRemoteConfig.setDefaults(resourceId);
}
}
示例2: onCreate
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Login checks
if (!CacheUtils.isLoggedIn(this) || !CacheUtils.isFireBaseSetup(this)) {
Intent intent = new Intent(this, OnBoardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
return;
}
//Now check if app update is required
firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
firebaseRemoteConfig.setDefaults(R.xml.config);
testIfAppUpdateIsRequired();
}
示例3: fetch
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
void fetch() {
FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
config.activateFetched();
config.fetch(urgentUpdateFlag ? 0 : cacheExpiration)
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("KiseFetcher", "onFailure: " + e.getMessage());
}
})
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d("KiseFetcher", "onSuccess");
}
})
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Log.d("KiseFetcher", "onComplete");
}
});
disableUrgentUpdateFlag();
}
示例4: onCreate
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
buildNotification();
setStatusMessage(R.string.connecting);
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
mPrefs = getSharedPreferences(getString(R.string.prefs), MODE_PRIVATE);
String email = mPrefs.getString(getString(R.string.email), "");
String password = mPrefs.getString(getString(R.string.password), "");
authenticate(email, password);
}
示例5: RemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions") public RemoteConfig(boolean isDebug, final IAnalytics analytics) {
firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings =
new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(isDebug).build();
firebaseRemoteConfig.setConfigSettings(configSettings);
firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
firebaseRemoteConfig.fetch().continueWith((Continuation<Void, Void>) task -> {
if (task.isSuccessful()) {
Log.e(TAG, "then: Success");
firebaseRemoteConfig.activateFetched();
analytics.setUserProperty(EXPERIMENT_ABOUT_MENU,
getExperimentVariant(EXPERIMENT_ABOUT_MENU));
return null;
}
Log.e(TAG, "then: Failure");
throw task.getException();
});
}
示例6: fetchFirebase
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
private void fetchFirebase() {
FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.getInstance();
remoteConfig.setConfigSettings(
new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build());
remoteConfig.fetch()
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
remoteConfig.activateFetched();
setup();
} else {
Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), "Da ist was schiefgelaufen.\nVersuche es noch einmal...", Snackbar.LENGTH_SHORT);
View snackbarView = snackbar.getView();
snackbarView.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), theme().primaryColorDark));
snackbar.show();
}
});
}
示例7: onCreate
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.UCOmoveTheme);
super.onCreate(savedInstanceState);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
setupView();
showHome();
checkLocationPermissionsIfNeeded();
setupGooglePlayRateIfNeeded();
}
示例8: refreshApiEndpoints
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
private void refreshApiEndpoints() {
FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.getInstance();
String apisString = remoteConfig.getString(FB_CONFIG_OSM_APIS);
if (apisString == null || apisString.isEmpty()) {
return;
}
String[] stringArray = apisString.replace("[", "").replace("]", "").split(",");
for (int i = 0; i < stringArray.length; i++) {
String apiHost = stringArray[i].replace("\"", "");
boolean enabled = remoteConfig.getBoolean(FB_CONFIG_OSM_API_ENABLED_PREFIX + i);
if (enabled) {
OsmApiEndpoint endpoint = new OsmApiEndpoint(apiHost);
initializeOsmService(endpoint);
osmOverpassApis.add(endpoint);
}
}
}
示例9: initialize
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
public AbstractDownloadHelper initialize(Activity activity) {
mActivity = activity;
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
mFirebaseRemoteConfig.fetch().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
mFirebaseRemoteConfig.activateFetched();
AD_RATE = mFirebaseRemoteConfig.getLong("ad_rate");
}
});
/* ColorTvSdk.init(activity, getAppId());
ColorTvSdk.setRecordAudioEnabled(false);
ColorTvSdk.onCreate();
ColorTvSdk.registerAdListener(mListener);*/
return this;
}
示例10: RemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
public RemoteConfig(boolean isDebug, final ITracking tracking) {
this.tracking = tracking;
firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(isDebug)
.build();
firebaseRemoteConfig.setConfigSettings(configSettings);
firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
firebaseRemoteConfig.fetch()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
firebaseRemoteConfig.activateFetched();
tracking.setUserProperty(EXPERIMENT_HOME_SCREEN_ABOUT_MENU, getExperimentVariant(EXPERIMENT_HOME_SCREEN_ABOUT_MENU));
}
}
});
}
示例11: provideFirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
@Provides @Singleton @Nullable
public FirebaseRemoteConfig provideFirebaseRemoteConfig() {
try {
FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings settings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
config.setConfigSettings(settings);
return config;
} catch (IllegalStateException ex) {
/* When there is no google-secrets.json file found, the library throws an exception
* here which causes insta-crashes for us. Silently recover here...
*/
TbaLogger.e("Unable to find google-secrets.json, disabling remote config");
return null;
}
}
示例12: init
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
private void init(){
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
//mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
}
示例13: init
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
public void init (FirebaseApp firebaseApp) {
mFirebaseApp = firebaseApp;
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
fetchRemoteConfigs();
}
示例14: initRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
private void initRemoteConfig() {
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
fetchRemoteConfig();
}
示例15: checkForUpdate
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //导入方法依赖的package包/类
public void checkForUpdate() {
remoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(true)
.build();
remoteConfig.setConfigSettings(configSettings);
remoteConfig.fetch(cache)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
remoteConfig.activateFetched();
String url = remoteConfig.getString("android");
boolean isOptional = remoteConfig.getBoolean("android_optional");
Config config = new Config(isOptional, url, color, cache, message, buttonText);
if (!url.isEmpty()) {
Intent appUpdateIntent = new Intent(activity, UpdateAppActivity.class);
appUpdateIntent.putExtra("data", config);
if (!activity.isDestroyed())
activity.startActivity(appUpdateIntent);
}
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
e.printStackTrace();
}
});
}