Skip to content

Instantly share code, notes, and snippets.

@StephenVinouze
Last active September 8, 2020 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StephenVinouze/6b5a6c152d43a1b1b9812ecec9f95754 to your computer and use it in GitHub Desktop.
Save StephenVinouze/6b5a6c152d43a1b1b9812ecec9f95754 to your computer and use it in GitHub Desktop.
@HiltAndroidApp
class UpdateDetectorApplication : Application() {
@Inject
lateinit var updateDetector: UpdateDetector
override fun onCreate() {
super.onCreate()
// Update app version for next session
updateDetector.updateVersion(BuildConfig.VERSION_NAME)
// Listen to app updates
updateDetector.doOnUpdate { previousVersion, newVersion ->
// Handle migration for specific versions
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment