Skip to content

Instantly share code, notes, and snippets.

@andreyfomenkov
Last active December 23, 2020 14:16
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/18b0b69037371e6aa71132ab32a7b0ce to your computer and use it in GitHub Desktop.
Save andreyfomenkov/18b0b69037371e6aa71132ab32a7b0ce to your computer and use it in GitHub Desktop.
Shell script to send broadcast event, pull report and display in a browser
#!/bin/bash
# Replace APPLICATION_ID, REPORT_DEVICE_LOCATION
# and REPORT_DESKTOP_LOCATION with your values
BROADCAST_ACTION="build-rx-report" # Intent filter action for BroadcastReceiver
APPLICATION_ID=com.myapplication # RENAME
SLEEP_BEFORE_PULL=3 # Give a time (in seconds) to generate & save HTML report
# Location in Android device SD card
REPORT_DEVICE_LOCATION=/storage/emulated/0/Android/data/$APPLICATION_ID/files/report.html
REPORT_DESKTOP_LOCATION=~/report.html # Location on desktop
adb shell am broadcast -a $BROADCAST_ACTION
sleep $SLEEP_BEFORE_PULL
adb pull $REPORT_DEVICE_LOCATION $REPORT_DESKTOP_LOCATION
adb shell rm $REPORT_DEVICE_LOCATION
open $REPORT_DESKTOP_LOCATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment