//leakcanary/leakcanary/AppWatcher
AppWatcher¶
object AppWatcher
The entry point API for using ObjectWatcher in an Android app. AppWatcher.objectWatcher is in charge of detecting retained objects, and AppWatcher is auto configured on app start to pass it activity and fragment instances. Call ObjectWatcher.watch on objectWatcher to watch any other object that you expect to be unreachable.
Functions¶
Name | Summary |
---|---|
appDefaultWatchers | fun appDefaultWatchers(application: Application, reachabilityWatcher: ReachabilityWatcher = objectWatcher): List<InstallableWatcher> Creates a new list of default app InstallableWatcher, created with the passed in reachabilityWatcher (which defaults to objectWatcher). Once installed, these watchers will pass in to reachabilityWatcher objects that they expect to become weakly reachable. |
manualInstall | @JvmOverloads fun manualInstall(application: Application, retainedDelayMillis: Long = TimeUnit.SECONDS.toMillis(5), watchersToInstall: List<InstallableWatcher> = appDefaultWatchers(application)) Enables usage of AppWatcher.objectWatcher which will expect passed in objects to become weakly reachable within retainedDelayMillis ms and if not will trigger LeakCanary (if LeakCanary is in the classpath). |
Properties¶
Name | Summary |
---|---|
isInstalled | val isInstalled: Boolean |
objectWatcher | val objectWatcher: ObjectWatcher The ObjectWatcher used by AppWatcher to detect retained objects. Only set when isInstalled is true. |
retainedDelayMillis | @Volatile val retainedDelayMillis: Long |