0

I'm about to launch my app.

I wrote a code for inApp immediate update since I want everyone who downloaded my app to update when I upload updated version.

I wonder if this code will work without causing any problem.

mAppUpdateManager = AppUpdateManagerFactory.create( this );
Task<AppUpdateInfo> appUpdateInfoTask = mAppUpdateManager.getAppUpdateInfo();
appUpdateInfoTask.addOnSuccessListener( new OnSuccessListener<AppUpdateInfo>() {
        @Override
        public void onSuccess(AppUpdateInfo result) {
            if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
            && result.isUpdateTypeAllowed( AppUpdateType.IMMEDIATE )){
                try {
                    mAppUpdateManager.startUpdateFlowForResult( result, AppUpdateType.IMMEDIATE, MainActivity.this, MY_REQUEST_CODE );
                } catch (IntentSender.SendIntentException e) {
                    Log.e( "AppUpdater", "AppUpdateManager Error", e );
                    e.printStackTrace();}
            }else {}
        }
    } );

1 Answers1

0

Please mention the issue you're facing. Meanwhile you can use this library to introduce in-app updates in your app. It's pretty simple to use and tested properly.

https://github.com/sohanzz/Easy-InApp-Updater

Asif A. Sohan
  • 202
  • 1
  • 5