Firebase SDK for Android: A tech deep dive - Google I/O 2016

By: Firebase

48   0   5718

Uploaded on 05/19/2016

The best engineers know to seek confidence that the SDKs they put into their apps are fast, small, and reliable. In this session, we deep dive into Google SDKs for Android and take a look at how various parts of them are implemented. Warning! Once you watch, you'll be prepared to design and execute your own Android code-fu. Use this knowledge with extreme caution!

Watch more Firebase talks at I/O 2016 here: https://goo.gl/JTH9Fr
See all the talks from Google I/O 2016 here: https://goo.gl/olw6kV
Subscribe to the brand new Firebase Channel: https://goo.gl/9giPHG -

Get started using Firebase today https://goo.gl/gCHr6r

#io16 #GoogleIO #GoogleIO2016 #Firebase

Comments (2):

By anonymous    2017-09-20

The actual solution according to a Google I/O talk:

class YourApplication : Application() {

  override fun onCreate() {
    super.onCreate()
    registerActivityLifecycleCallbacks(AppLifecycleTracker())
  }

}


class AppLifecycleTracker : Application.ActivityLifecycleCallbacks  {

  private var numStarted = 0

  override fun onActivityStarted(activity: Activity?) {
    if (numStarted == 0) {
      // app went to foreground
    }
    numStarted++
  }

  override fun onActivityStopped(activity: Activity?) {
    numStarted--
    if (numStarted == 0) {
      // app went to background
    }
  }

}

Yes. I know it's hard to believe this simple solution works since we have so many weird solutions here.

But there is hope.

Original Thread

Recommended Books

    Popular Videos 4918

    Submit Your Video

    If you have some great dev videos to share, please fill out this form.