AppWatcherStartupInitializer.kt
TLDR
This file contains the AppWatcherStartupInitializer
class, which is an implementation of the Initializer
interface. It initializes the AppWatcher library for monitoring memory leaks in an Android application.
Classes
AppWatcherStartupInitializer
The AppWatcherStartupInitializer
class is an implementation of the Initializer
interface. It is responsible for initializing the AppWatcher library in an Android application.
create(context: Context)
This method is called when the initializer is initialized. It takes a Context
parameter and installs the AppWatcher library by calling the AppWatcher.manualInstall()
method with the application context.
dependencies()
This method returns an empty list of initializers that the AppWatcherStartupInitializer
depends on.
package leakcanary
import android.app.Application
import android.content.Context
import androidx.startup.Initializer
class AppWatcherStartupInitializer : Initializer<AppWatcherStartupInitializer> {
override fun create(context: Context) = apply {
val application = context.applicationContext as Application
AppWatcher.manualInstall(application)
}
override fun dependencies() = emptyList<Class<out Initializer<*>>>()
}