I tried using the In App Update API from the PlayCore sdk, but after the app auto updates, it didn't restart. When reading the manual, it said if after the app updates and install and it didn't restart, you have to log the error. But when I add the log script for the error handler, it never did log anything.
Here's my code:
private IEnumerator CheckAppUpdate()
{
AppUpdateManager appUpdateManager = new AppUpdateManager();
PlayAsyncOperation<AppUpdateInfo, AppUpdateErrorCode> appUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
// Wait until the asynchronous operation completes.
yield return appUpdateInfoOperation;
if (appUpdateInfoOperation.IsSuccessful)
{
var appUpdateInfoResult = appUpdateInfoOperation.GetResult();
if (appUpdateInfoResult.UpdateAvailability == UpdateAvailability.UpdateAvailable) {
updateAvailable = true;
AppUpdateOptions appUpdateOptions = AppUpdateOptions.ImmediateAppUpdateOptions();
yield return StartImmediateUpdate(appUpdateManager, appUpdateInfoResult, appUpdateOptions);
}
}
else
Debug.LogError($"Error:\n{appUpdateInfoOperation.Error}");
}
private IEnumerator StartImmediateUpdate(AppUpdateManager appUpdateManager, AppUpdateInfo updateInfo, AppUpdateOptions updateOptions)
{
var immediateUpdateRequest = appUpdateManager.StartUpdate(updateInfo, updateOptions);
yield return immediateUpdateRequest;
//If this Line is reached, the app didn't restart and that means the install failed
Debug.LogError("Install Update Error:\n" + immediateUpdateRequest.Error);
}
And as you can see from this screenshot of my Error Log, it never reached the Debug.LogError line.
PS. I'm using Unity 2020.38.3f and using the Developer Build Option so I can check the log in my editor after I build the apk.