In-app update is available multiple times in my app. User can cancel the update first time while opening the app and choose to trigger in-app Update from another fragment manually.
As per Google documentation, I have created new instances each time to trigger the update but it is only working for the first. Next time, it's causing AppUpdateManager.startUpdateFlowForResult causing IntentSender$SendIntentException
private void init() {
appUpdateManager = AppUpdateManagerFactory.create(mContext);
appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
}
public void checkAppUpdate() {
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
.....................................
.....................................
startAppUpdate(appUpdateInfo);
}
private void startAppUpdate(AppUpdateInfo appUpdateInfo) {
Log.d(TAG, "startAppUpdate: starting app update");
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo,
appUpdateType,
mActivityReference,
mRequestCode);
}