I am following below link to provide app update experience or feature in my android live application.
The link is here : https://developer.android.com/guide/playcore/in-app-updates#java
From the link content, I am implementing Immediate App Update feature.
So far, I have done as below steps :
- Downgraded my application version and version code as well.
- Generated new Release APK and Insalled it in my Android device.
- Added below code for the App update functionality in my Splash Activity.
Implemented below Code :
First added dependency : implementation 'com.google.android.play:core:1.7.1'
Then, In Splash Activity,
// Creates instance of the manager.
final AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(SplashActivity.this);
// 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(new OnSuccessListener<AppUpdateInfo>() {
@Override
public void onSuccess(AppUpdateInfo appUpdateInfo) {
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
// For a flexible update, use AppUpdateType.FLEXIBLE
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
// Request the update.
try {
appUpdateManager.startUpdateFlowForResult(appUpdateInfo, AppUpdateType.IMMEDIATE, SplashActivity.this,500);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}else
{
//Continuing with the Application flow
}
}
The Issue is: When I have generated Signed APK and installed in My android device.
Getting below error in log :
Auth: [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION. Account: <ELLIDED:9494777414>, App: com.google.android.gms, Service: oauth2:https://www.googleapis.com/auth/emeraldsea.mobileapps.doritos.cookie
What might be the Issue ?