Hi there and happy new year!

Not that it's not easy to find this information but I recently signed up on Snapchat and let's be honest, it's not easy to capture the device screen when long tapping the screen.

Fortunately, Android development kit comes with a shell that allows to control your device from your computer through adb. No teaching you anything today.

I quickly wrote a tiny script that would allow anyone who found the way to install adb to capture your device screen remotely.

Create a screenshot file in the same folder of the adb binary and paste the following content inside:

#!/bin/bash

FILENAME=$(date +"%F-%k%M%S").png
./adb shell screencap -p /sdcard/$FILENAME
./adb pull /sdcard/$FILENAME
./adb shell rm /sdcard/$FILENAME
open $FILENAME

exit $?

Make sure your file is executable (chmod u+x screenshot) and that the USB debug mode is enabled on your device.

From your shell, just launch the script whenever you wish to capture your device screen:

$ ./screenshot
4193 KB/s (80136 bytes in 0.018s)

That's it. You're a Snapchat hero!


Joris Berthelot