Skip to content

Instantly share code, notes, and snippets.

@andreyfomenkov
Last active December 18, 2020 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreyfomenkov/6c2c6d349cfe23e921edfc433e4bdbe7 to your computer and use it in GitHub Desktop.
Save andreyfomenkov/6c2c6d349cfe23e921edfc433e4bdbe7 to your computer and use it in GitHub Desktop.
Meanwhile in Application class
fun registerReceiver() {
val filter = IntentFilter()
filter.addAction("build-rx-report") // Action from report.sh
val receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val result = RxDisposableWatcher.probe()
val report = HtmlReportBuilder(result).build()
val file = File(getExternalFilesDir(null), "report.html")
val stream = FileOutputStream(file)
stream.use {
it.write(report.toByteArray())
}
Log.d(TAG, "Report saved to: ${file.path}")
}
}
registerReceiver(receiver, filter)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment