Skip to content

Instantly share code, notes, and snippets.

@SanojPunchihewa
SanojPunchihewa / MainActivity.java
Created May 13, 2020 16:37
Add UpdateInfoListener
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
@SanojPunchihewa
SanojPunchihewa / MainActivity.java
Last active August 2, 2019 14:32
continueUpdates onResume of the Activity
@Override
protected void onResume() {
super.onResume();
// Continue updates when resumed
mUpdateManager.continueUpdate();
}
@SanojPunchihewa
SanojPunchihewa / MainActivity.java
Last active August 2, 2019 14:33
Initialize the UpdateManager in Activity
// Declare the UpdateManager
UpdateManager mUpdateManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize the Update Manager with the Activity and the Update Mode
mUpdateManager = UpdateManager.Builder(this).mode(UpdateManagerConstant.FLEXIBLE);
@SanojPunchihewa
SanojPunchihewa / build.gradle
Last active May 13, 2020 16:32
Add InAppUpdater dependency to app level gradle
dependencies {
implementation 'com.github.SanojPunchihewa:InAppUpdater:1.0.5'
}
@SanojPunchihewa
SanojPunchihewa / build.gradle
Created July 16, 2019 12:12
Include jitpack in root build.gradle to pull InAppUpdater
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}