本文整理汇总了Java中com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings类的典型用法代码示例。如果您正苦于以下问题:Java FirebaseRemoteConfigSettings类的具体用法?Java FirebaseRemoteConfigSettings怎么用?Java FirebaseRemoteConfigSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FirebaseRemoteConfigSettings类属于com.google.firebase.remoteconfig包,在下文中一共展示了FirebaseRemoteConfigSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConfigSettings
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
public void setConfigSettings(final CallbackContext callbackContext, final JSONObject config) {
mFirebase.cordova.getThreadPool().execute(new Runnable() {
public void run() {
try {
Log.i(TAG, "Setting config settings");
boolean devMode = config.getBoolean("developerModeEnabled");
FirebaseRemoteConfigSettings.Builder settings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(devMode);
FirebaseRemoteConfig.getInstance().setConfigSettings(settings.build());
callbackContext.success();
} catch (Exception e) {
Log.e(TAG, "Error setting config settings", e);
callbackContext.error(e.getMessage());
}
}
});
}
示例2: onCreate
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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);
}
示例3: RemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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();
});
}
示例4: fetchFirebase
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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();
}
});
}
示例5: RemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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));
}
}
});
}
示例6: provideFirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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;
}
}
示例7: init
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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);
}
示例8: init
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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();
}
示例9: initRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
private void initRemoteConfig() {
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
fetchRemoteConfig();
}
示例10: checkForUpdate
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的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();
}
});
}
示例11: onCreate
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
FirebaseRemoteConfig.getInstance().setConfigSettings(configSettings);
FirebaseRemoteConfig.getInstance().setDefaults(R.xml.firebase_remote_config_defaults);
}
示例12: setDebugMode
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
void setDebugMode(boolean debugMode) {
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(debugMode)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
mDebugMode = debugMode;
}
示例13: update
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
private void update(final long ttlSeconds, final CallbackContext callbackContext) {
cordova.getThreadPool().execute(new Runnable() {
public void run() {
if (ttlSeconds == 0) {
// App should use developer mode to fetch values from the service
firebaseRemoteConfig.setConfigSettings(
new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(true)
.build()
);
}
firebaseRemoteConfig.fetch(ttlSeconds)
.addOnCompleteListener(cordova.getActivity(), new OnCompleteListener<Void>() {
@Override
public void onComplete(Task<Void> task) {
if (task.isSuccessful()) {
firebaseRemoteConfig.activateFetched();
callbackContext.success();
} else {
callbackContext.error(task.getException().getMessage());
}
}
});
}
});
}
示例14: firebaseRemoteConfigSettings
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
private void firebaseRemoteConfigSettings() {
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
}
示例15: onCreate
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWelcomeTextView = findViewById(R.id.welcomeTextView);
Button fetchButton = findViewById(R.id.fetchButton);
fetchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fetchWelcome();
}
});
// Get Remote Config instance.
// [START get_remote_config_instance]
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
// [END get_remote_config_instance]
// Create a Remote Config Setting to enable developer mode, which you can use to increase
// the number of fetches available per hour during development. See Best Practices in the
// README for more information.
// [START enable_dev_mode]
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
mFirebaseRemoteConfig.setConfigSettings(configSettings);
// [END enable_dev_mode]
// Set default Remote Config parameter values. An app uses the in-app default values, and
// when you need to adjust those defaults, you set an updated value for only the values you
// want to change in the Firebase console. See Best Practices in the README for more
// information.
// [START set_default_values]
mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
// [END set_default_values]
fetchWelcome();
}