Skip to content

Instantly share code, notes, and snippets.

@harshabhadra
Created October 13, 2019 14:48
Show Gist options
  • Save harshabhadra/048d05b692d145ae46d4729cb2aa46f1 to your computer and use it in GitHub Desktop.
Save harshabhadra/048d05b692d145ae46d4729cb2aa46f1 to your computer and use it in GitHub Desktop.
// [START display_welcome_message]
private void displayWelcomeMessage() {
// [START get_config_values]
String welcomeMessage = mFirebaseRemoteConfig.getString(WELCOME_MESSAGE_KEY);
String versionName = mFirebaseRemoteConfig.getString(VERSION_NAME_KEY);
if (versionName.equals(version) && mFirebaseRemoteConfig.getBoolean(CREATE_FORCE_UPDATE_DIALOG_KEY)) {
Log.e(TAG, "true");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getResources().getString(R.string.dialog_message));
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(MY_APP_URL));
startActivity(intent);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
});
builder.setCancelable(false);
AlertDialog dialog = builder.create();
dialog.show();
} else {
Log.e(TAG, "false");
}
mWelcomeTextView.setText(welcomeMessage);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment