Skip to content

Instantly share code, notes, and snippets.

@amanjeetsingh150
Last active April 21, 2022 13:42
Show Gist options
  • Save amanjeetsingh150/ab11a54ffaa9fc7f0bd117d7652c8cf9 to your computer and use it in GitHub Desktop.
Save amanjeetsingh150/ab11a54ffaa9fc7f0bd117d7652c8cf9 to your computer and use it in GitHub Desktop.
Dumping screenshots via dadb
fun pullScreenshots(): File {
val screenshotPath = "/data/local/tmp/screenshots/<file_name_here>.png"
// 1
dadb.shell("screencap -p $screenshotPath")
// 2
val outputFile = File.createTempFile(outputFileName, ".txt")
val bufferedSink = outputFile.sink().buffer()
dadb.pull(bufferedSink, logFilePath)
return outputFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment