Created
March 13, 2020 01:50
-
-
Save pyeongho/5a3a3bcfa25b9b85e1dd4c3a6d474c2b to your computer and use it in GitHub Desktop.
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
class OnAppObserver : LifecycleObserver { | |
companion object { | |
var APP_STATUS: AppStatus = AppStatus.NOTEXECUTE | |
} | |
enum class AppStatus { | |
NOTEXECUTE, | |
BACKGROUND, | |
FOREGROUND | |
} | |
@OnLifecycleEvent(Lifecycle.Event.ON_START) | |
fun onStart() { | |
APP_STATUS = AppStatus.FOREGROUND | |
} | |
@OnLifecycleEvent(Lifecycle.Event.ON_STOP) | |
fun onStop() { | |
APP_STATUS = AppStatus.BACKGROUND | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment