A detector for front-to-back switching of android apps
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.VinsonGuo:AndroidBackgroundDetector:1.0.0'
}
application.addBackgroundDetectListener {
Log.d("BackgroundDetector", "App is in background $it")
// do something
}