com.google.android.play.core.appupdate.AppUpdateManagerFactory Java Examples

The following examples show how to use com.google.android.play.core.appupdate.AppUpdateManagerFactory. 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: AppUpdateControllerFactory.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
/**
 * @param callback {@link Runnable} to notify when there is a change in update state.
 * @param context Application context of app.
 * @return A new {@link FlexibleAppUpdateController} to use for in-app updates
 */
public static FlexibleAppUpdateController create(Runnable callback, Context context) {
    boolean showInAppUpdate;
    try {
        showInAppUpdate = CommCareApplication.instance().getSession().shouldShowInAppUpdate();
    } catch (SessionUnavailableException e) {
        showInAppUpdate = true;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && showInAppUpdate) {
        // In-app updates works only with devices running Android 5.0 (API level 21) or higher
        return new CommcareFlexibleAppUpdateManager(callback, AppUpdateManagerFactory.create(context));
    } else {
        return new DummyFlexibleAppUpdateManager();
    }
}
 
Example #2
Source File: UpdateManager.java    From InAppUpdater with MIT License 4 votes vote down vote up
private UpdateManager(AppCompatActivity activity) {
    mActivityWeakReference = new WeakReference<>(activity);
    this.appUpdateManager = AppUpdateManagerFactory.create(getActivity());
    this.appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
    activity.getLifecycle().addObserver(this);
}
 
Example #3
Source File: ActivityModule.java    From VoIpUSSD with Apache License 2.0 4 votes vote down vote up
@Provides
@ActivityScope
public AppUpdateManager provideAppUpdateManager() {
    return AppUpdateManagerFactory.create(mActivity);
}
 
Example #4
Source File: CommcareImmediateAppUpdateManager.java    From commcare-android with Apache License 2.0 4 votes vote down vote up
CommcareImmediateAppUpdateManager(CommCareActivity activity) {
    this.activity = activity;
    mAppUpdateManager = AppUpdateManagerFactory.create(activity.getApplicationContext());
    activity.getLifecycle().addObserver(this);
}
 
Example #5
Source File: InAppUpdateManager.java    From android-inapp-update with Apache License 2.0 3 votes vote down vote up
private void init() {
    setupSnackbar();

    appUpdateManager = AppUpdateManagerFactory.create(this.activity);

    activity.getLifecycle().addObserver(this);

    if (mode == UpdateMode.FLEXIBLE)
        appUpdateManager.registerListener(installStateUpdatedListener);

    checkForUpdate(false);
}