I am using in-app update but it is not working in production. I tried various ways but could not resolve the issue. The code is in java for android studio project My code is below:-
private void checkUpdate() {
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
Toast.makeText(getApplicationContext(), "Update available", Toast.LENGTH_LONG).show();
startUpdateFlow(appUpdateInfo);
} else if (appUpdateInfo.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS){
Toast.makeText(getApplicationContext(), "Reached 2.. ", Toast.LENGTH_LONG).show();
startUpdateFlow(appUpdateInfo);
} else if (appUpdateInfo.updateAvailability()==UpdateAvailability.UPDATE_NOT_AVAILABLE){
Toast.makeText(getApplicationContext(), "Update unavailable", Toast.LENGTH_LONG).show();
Intent intent = new Intent(getApplicationContext(), StartActivity.class);
startActivity(intent);
finish();
}
});
}
```
Please tell me what is the mistake I am doing
You have not created the code to force
App Update. I also created code for app updates and mine is aFlexibleupdate. Match your code with mine and make changes in your code or use my code to test your app.Let me know if my code does not work in your app.