savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RemoteConfig.init(this); RemoteConfig.updateConfig(this, task -> { RemoteConfig.getUpdateNoticeConfig(this) .filter(value -> !TextUtils.isEmpty(value)) .flatMap(UpdateNotice::parseJson) .filter(value -> getSharedPreferences("update_notice", Context.MODE_PRIVATE).getInt("showed_update_notice_version", 0) < value.updateApplicationVersion) .filter(value -> BuildConfig.VERSION_CODE < value.updateApplicationVersion) .ifPresent(this::showUpdateDialog); }); } private void showUpdateDialog(UpdateNotice updateNotice) { new AlertDialog.Builder(this) .setTitle(updateNotice.updateTitle) .setMessage(updateNotice.updateMessage) .setPositiveButton("Ξοϓσʔτ͢Δ", (dialogInterface, i) -> { IntentUtil.openGooglePlayAppDetails(this, getPackageName()); }) .setNegativeButton("ด͡Δ", (dialogInterface, i) -> { }) .show(); getSharedPreferences("update_notice", Context.MODE_PRIVATE) .edit() .putInt("showed_update_notice_version", updateNotice.updateApplicationVersion) .apply(); } }