Check app update in Apklis
- Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Step 2. Add the dependency
implementation 'com.github.Z17-CU:apklisupdate:$VERSION'
- Check current app
ApklisUpdate.hasAppUpdate(this, callback = object : UpdateCallback {
override fun onNewUpdate(appUpdateInfo: AppUpdateInfo) {
//Start info alert dialog or do what you want.
ApklisUpdateDialog(
this@MainActivity,
appUpdateInfo,
ContextCompat.getColor(
this@MainActivity,
R.color.colorAccent)
).show()
//Start info fragment or do what you want.
supportFragmentManager.beginTransaction().add(
R.id.container, ApklisUpdateFragment.newInstance(
updateInfo = appUpdateInfo,
actionsColor = ContextCompat.getColor(this@MainActivity, R.color.colorAccent)
)
).commit()
}
override fun onOldUpdate(appUpdateInfo: AppUpdateInfo) {
Log.d("MainActivity", "onOldUpdate $appUpdateInfo")
}
override fun onError(e: Throwable) {
e.printStackTrace()
}
})
- Check external app
ApklisUpdate.hasAppUpdate("APP_PACKAGE_NAME", callback = object : UpdateCallback {...})
All contributions are welcome!!!