I have a code to check for any updates on the play store for my app, here is the code below.
private AppUpdateManager appUpdateManager;
int REQUEST_APP_UPDATE=888;
setContentView(R.layout.activity_starternew);
checkforupdate();
public void checkforupdate{
appUpdateManager =AppUpdateManagerFactory.create(Starternew.this);
appUpdateManager
.getAppUpdateInfo()
.addOnSuccessListener(
appUpdateInfo -> {
if ((appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
try {
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo,
AppUpdateType.IMMEDIATE,
this,
REQUEST_APP_UPDATE);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
//}
});}
Below is the onresume method
@Override
protected onResume(){
super.onResume();
appUpdateManager
.getAppUpdateInfo()
.addOnSuccessListener(
appUpdateInfo ->{
if (appUpdateInfo.updateAvailability()==UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS){
try {
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo,
AppUpdateType.IMMEDIATE,
this,
REQUEST_APP_UPDATE
);
}catch (IntentSender.SendIntentException e){
e.printStackTrace();
}
}
});
// )
}}
I was informed of a class know as Fake appupdatemanager to test if it works or not but am not quite sure how it works. I tried changing private AppUpdateManager to private Fake appupdatemanager but to no avail, and this will be my first time loading an app onto the play store, how can I test my code using the same Fake appupdatemanager.