Last active
June 14, 2024 12:27
-
-
Save ali-star/5fac9183a74dcb454a881939041968e5 to your computer and use it in GitHub Desktop.
LeakCanary EventListener
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 DebugApplication : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
val analysisUploadListener = EventListener { event -> | |
if (event is EventListener.Event.HeapAnalysisDone.HeapAnalysisSucceeded) { | |
val heapAnalysis = event.heapAnalysis | |
TODO("Intercept leaks") | |
} | |
} | |
LeakCanary.config = LeakCanary.config.run { | |
copy(eventListeners = eventListeners + analysisUploadListener) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment