I implement In-App Update feature in my android application but it not working untill i go to playstore app and view update button. Please suggest me some solution. Thanks
public void ImmidateUpdate()
{
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(getActivity());
// 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)
{
if(appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE))
{
try {
appUpdateManager.startUpdateFlowForResult(
// Pass the intent that is returned by 'getAppUpdateInfo()'.
appUpdateInfo,
// Or 'AppUpdateType.FLEXIBLE' for flexible updates.
AppUpdateType.IMMEDIATE,
// The current activity making the update request.
getActivity(),
// Include a request code to later monitor this update request.
1210);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
}
});
}