在Play商店控制台中是否有可用选项来配置此值?
以下是官方文档代码:
// Creates instance of the manager.
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
// Returns an intent object that you use to check for an update.
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
// Checks that the platform will allow the specified type of update.
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
// For a flexible update, use AppUpdateType.FLEXIBLE
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
// Request the update.
}
});
我们如何了解:
appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)
如何配置上述类型?在官方文档中没有相关说明。
在AppUpdateInfo.class中:
public final boolean isUpdateTypeAllowed(int var1) {
if (var1 == 0) {
return this.f != null;
} else if (var1 == 1) {
return this.e != null;
} else {
return false;
}
}
其中f
和e
是PendingIntent
,并且方法基于它们的值返回true
或false
。