Last active
May 18, 2020 07:27
-
-
Save EdgeJH/fadfeef676fa2785d05e961606759635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_flexible); | |
UpdateManager.Builder builder = new UpdateManager.Builder() | |
.setActivity(this) | |
.setUpdateType(UpdateType.FLEXIBLE); | |
final UpdateManager updateManager = builder.create(); | |
updateManager.setUpdateListener(new UpdateListener() { | |
@Override | |
public void onUpdateChecked(@NotNull AppUpdateInfo appUpdateInfo, boolean updateAvailable) { | |
if (updateAvailable) { | |
updateManager.update(appUpdateInfo); | |
} | |
} | |
@Override | |
public void onUpdateCheckFailure(@Nullable Exception exception) { | |
if (exception != null) { | |
Log.d("abcd", "error : " + exception.getMessage()); | |
} | |
} | |
@Override | |
public void onUpdateState(@NotNull InstallState installState, long bytesDownLoaded, long totalBytesToDownLoaded) { | |
if (installState.installStatus() == InstallStatus.DOWNLOADED) { | |
updateManager.showSnackBarForCompleteUpdate("업데이트가 완료 되었습니다", ContextCompat.getColor(FlexibleUpdateActivity.this, R.color.colorAccent)); | |
} | |
} | |
}); | |
updateManager.checkUpdate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment