5
Pembaruan Dalam Aplikasi memberi InstallException (ERROR_API_NOT_AVAILABLE)
Diimplementasikan fitur pembaruan dalam aplikasi, menggunakan potongan kode berikut: private void showInAppUpdateDialog(boolean isMandatoryUpdate) { Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo(); appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> { if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE || appUpdateInfo.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) { int appUpdateType = isMandatoryUpdate ? IMMEDIATE : AppUpdateType.FLEXIBLE; int requestCode = isMandatoryUpdate ? REQUEST_APP_UPDATE_IMMEDIATE : REQUEST_APP_UPDATE_FLEXIBLE; if (appUpdateInfo.isUpdateTypeAllowed(appUpdateType)) { // …