This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onResume() { | |
super.onResume(); | |
// Continue updates when resumed | |
mUpdateManager.continueUpdate(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'com.github.SanojPunchihewa:InAppUpdater:1.0.5' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
repositories { | |
maven { url "https://jitpack.io" } | |
} | |
} |