An android library to check your applications latest available updates seamlessly.
Current version
This library is also available at JitPack.io
Add the JitPack repository to your build file.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.rpahade3011:InAppUpdater:current_version'
}
OR
Add the dependency
dependencies {
implementation 'com.android.rudraksh.inappupdate:InAppUpdater:current_version'
}
In your Activity or Fragment include the InAppUpdateManager to use.
import com.android.rudraksh.inappupdate.InAppUpdateManager;
import com.android.rudraksh.inappupdate.UpdateType;
import com.android.rudraksh.inappupdate.UserResponse;
private InAppUpdateManager mInAppUpdateManager;
Initalize the InAppUpdateManger
mInAppUpdateManager = InAppUpdateManager.initialize(this);
Starts checking for new update if found.
mInAppUpdateManager.checkAvailableUpdateIfFound(versionCode -> {
Log.d(TAG, "Found new version: " + versionCode);
txtAvailableVersion.setText(String.valueOf(versionCode));
mInAppUpdateManager.popupDialogForUpdateAvailability(userResponse -> {
if (userResponse == UserResponse.ACCEPTED) {
mInAppUpdateManager.setDefaultUpdateMode(UpdateType.APP_UPDATE_TYPE_FLEXIBLE)
.startCheckingForUpdates();
} else {
mInAppUpdateManager.popupSnackbarForUpdateRejection();
}
});
});
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.