com.google.android.play.core.install.InstallState Java Examples

The following examples show how to use com.google.android.play.core.install.InstallState. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateManager.java    From InAppUpdater with MIT License 6 votes vote down vote up
@Override
public void onStateUpdate(InstallState installState) {
    if (installState.installStatus() == InstallStatus.DOWNLOADING) {
        long bytesDownloaded = installState.bytesDownloaded();
        long totalBytesToDownload = installState.totalBytesToDownload();
        if (flexibleUpdateDownloadListener != null) {
            flexibleUpdateDownloadListener.onDownloadProgress(bytesDownloaded, totalBytesToDownload);
        }
    }
    if (installState.installStatus() == InstallStatus.DOWNLOADED) {
        // After the update is downloaded, show a notification
        // and request user confirmation to restart the app.
        Log.d(TAG, "An update has been downloaded");
        popupSnackbarForCompleteUpdate();
    }
}
 
Example #2
Source File: InAppUpdateManager.java    From android-inapp-update with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateUpdate(InstallState installState) {
    inAppUpdateStatus.setInstallState(installState);

    reportStatus();

    // Show module progress, log state, or install the update.
    if (installState.installStatus() == InstallStatus.DOWNLOADED) {
        // After the update is downloaded, show a notification
        // and request user confirmation to restart the app.
        popupSnackbarForUserConfirmation();
    }
}
 
Example #3
Source File: MainActivity.java    From VoIpUSSD with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateUpdate(InstallState installState) {
    if (installState.installStatus() == InstallStatus.DOWNLOADED) {
        showMessage("Has been Downloaded!!!");
        notifyUser();
    }
}
 
Example #4
Source File: CommcareFlexibleAppUpdateManager.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateUpdate(InstallState state) {
    Logger.log(TAG, "Install state updated with install status: " + state.installStatus()
            + ", and error code: " + state.installErrorCode());
    mInstallErrorCode = state.installErrorCode();
    if (state.installStatus() == InstallStatus.DOWNLOADING) {
        // TODO: Should be keep on publishing status for showing download percentage.
        // From https://stackoverflow.com/a/10415638/6671572
        percentageDownloaded = (int) (state.bytesDownloaded() * 100.0 / state.totalBytesToDownload() + 0.5) ;
    }
    if (mInstallStatus != state.installStatus()) {
        mInstallStatus = state.installStatus();
        publishStatus();
    }
}
 
Example #5
Source File: InAppUpdateStatus.java    From android-inapp-update with Apache License 2.0 4 votes vote down vote up
public void setInstallState(InstallState installState) {
    this.installState = installState;
}
 
Example #6
Source File: DummyFlexibleAppUpdateManager.java    From commcare-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onStateUpdate(InstallState state) {

}