Skip to content

Instantly share code, notes, and snippets.

@jmfayard
Created November 10, 2015 20:48
Show Gist options
  • Save jmfayard/4740cba818a998323f9b to your computer and use it in GitHub Desktop.
Save jmfayard/4740cba818a998323f9b to your computer and use it in GitHub Desktop.
// Standard android variant of https://gist.github.com/jmfayard/2f7b4e7d29f76f6d4999
open class MyActivity : Activity() {
val sdkXYZ : DummyClass
val otherFeature: DummyClass
override fun onCreate() {
super.onCreate()
sdkXYZ = DummyClass()
otherFeature = DummyClass()
hockeySdkStartMonitoring()
}
override fun onDestroy() {
super.onDestroy()
hockeySdkStopMonitoring()
}
override fun onPause() {
super.onPause()
otherFeature.println("Do this in onPause()")
}
override fun onResume() {
super.onResume()
otherFeature.println("Do this in onResume()")
}
override fun onStart() {
super.onStart()
sdkXYZ.println("SDK XYZ needs to do something in onStart()")
}
override fun onStop() {
super.onStop()
sdkXYZ.println("SDK XYZ needs to do something in onStop()")
}
private fun hockeySdkStopMonitoring() {
println("HockeySdk : start monigoring")
}
private fun hockeySdkStartMonitoring() {
println("HockeySdk : stop monigoring")
}
}
data class DummyClass() {
fun println(String s) = println(s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment