Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SanojPunchihewa authored May 12, 2020
1 parent a52e4c3 commit 7ee1844
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,39 @@ There are two modes

* Immediate(`UpdateManagerConstant.IMMEDIATE`) - User will be blocked until download and installation is finished, restart is triggered automatically

**Additionally** you can get the Available Version Code of the update and the Number of days passed since the user was notified of an update through the Google Play. You can find these codes in the [demo app](/app/src/main/java/com/zanojmobiapps/inappupdatedemoapp/MainActivity.java)

### Step 4: Resume the updates
Call `continueUpdate` method in your `onResume` method to install waiting updates
```java
@Override
protected void onResume() {
super.onResume();
// Continue updates when resumed
mUpdateManager.continueUpdate();
}
mUpdateManager.addUpdateInfoListener(new UpdateInfoListener() {
@Override
public void onReceiveVersionCode(final int code) {
// You can get the available version code of the apk in Google Play
// Do something here
}

@Override
public void onReceiveStalenessDays(final int days) {
// Number of days passed since the user was notified of an update through the Google Play
// If the user hasn't notified this will return -1 as days
// You can decide the type of update you want to call
}
});
```
**Additionally** you can get the Available Version Code of the update. You can find these codes in the [demo app](/app/src/main/java/com/zanojmobiapps/inappupdatedemoapp/MainActivity.java)

**Monitoring the flexible update download progres**

You can monitor the download progress of a Flexible Update using this callback.
***Note***: This is only available for Flexible update mode. You can find more from the [official doc](https://developer.android.com/guide/playcore/in-app-updates#monitor_flexible)
```java
mUpdateManager.getAvailableVersionCode(new onVersionCheckListener() {
// Callback from Flexible Update Progress
mUpdateManager.addFlexibleUpdateDownloadListener(new FlexibleUpdateDownloadListener() {
@Override
public void onReceiveVersionCode(final int code) {
// Do something here
public void onDownloadProgress(final long bytesDownloaded, final long totalBytes) {
// Show a progress bar or anything you want
}
});
```

## :movie_camera: Demo
Flexible Update | Immediate Update
:-------------------------:|:-------------------------:
Expand Down

0 comments on commit 7ee1844

Please sign in to comment.