Skip to main content
No Result Found

Test using adb commands

Learn how to use adb commands on Android devices when testing on BrowserStack App Live

Android Debug Bridge (adb) is a robust command-line tool that allows you to communicate with a connected Android device. Using adb commands, you can perform a variety of device actions, such as installing apps, granting permissions, profiling for performance, etc.
You can now run adb commands when testing your Android apps on BrowserStack App Live.

Follow these steps to access the adb command interface and run your commands:

  1. Log in to the App Live dashboard.
  2. Select your app and the device to launch your test session.
    The DevTools pane opens automatically. If you close it and want to open it again, click the DevTools option in the horizontal toolbar.
    View the devtools pane
  3. In the DevTools pane, click the ADB Shell tab to open the command interface.
  4. Use this command interface to run supported adb commands. See the adb commands use cases section for supported commands.

adb commands use cases

This section provides details on how to run adb commands for the following use cases in an App Live session:

Note: Currently, we support only the adb commands mentioned in this guide.

Log and debug Firebase Analytics events

Log Events

You can set verbose logging to monitor the logs of Firebase events using the following setprop commands:

setprop log.tag.FA VERBOSE
setprop log.tag.FA-SVC VERBOSE

When you run this command, logs for Firebase events will start appearing under device logs. You can capture the complete logs by using driver.manage().logs().get("logcat").filter(Level.ALL); command and then filter out the firebase events for your app in your test.

Debug Events

You can enable the debug mode for Firebase Analytics on an Android device by using the following setprop command:

setprop debug.firebase.analytics.app <PACKAGE_NAME>

When you run this command, your test session will begin on a device where debug mode has been enabled. You can then navigate to DebugView to view your app’s events being logged in the DebugView report.

Log Google Analytics events

You can enable the log feature of Google Analytics events by using the following setprop command:

setprop log.tag.GAv4 DEBUG

When you run this command, logs for Google Analytics events will start appearing under device logs. You can capture the complete logs by using driver.manage().logs().get("logcat").filter(Level.ALL); command and then filter out the Google Analytics events for your app in your test.

Set system-level preferences using settings commands

The settings put commands can be used to set system-level device preferences such as disabling pop-up notifications, disabling location services, changing device orientation etc.

The following table lists all the settings put commands that are supported in App Live:

Command Description Allowed Values
settings put secure location_mode 0 Enable/Disable location services on an android device Disable: 0
Enable: 3
settings put global heads_up_notifications_enabled 0 Enable/Disable pop-up notifications on an android device Disable: 0
Enable: 1
settings put global always_finish_activities 0 Enable/Disable aggressive finishing of activities and processes Disable: 0
Enable: 1
settings put system accelerometer_rotation 0 Enable/Disable auto-rotation of the device Disable: 0
Enable: 1
settings put system user_rotation 3 Rotate the device 0° clockwise rotation: 0
90° clockwise rotation: 1
180° clockwise rotation: 2
270° clockwise rotation: 3
Important: The location_mode setting can only be used on API level 19 (Android Version 4.4) to API level 28 (Android Version 9) devices.

Get diagnostic output for system services using dumpsys commands

dumpsys is a tool that runs on Android devices and offers information on system services. dumpsys commands provide vital diagnostic output for system services operating on a connected device.

The following table lists all the dumpsys commands that can be used in an App Live session:

Command Description
dumpsys activity -p <package_name> Provides complete activity history for the given package
dumpsys window windows | grep -E "mCurrentFocus|mFocusedApp" Prints current app’s opened activity
dumpsys activity -p <package_name> activities Provides activity manager activities that contain main stack, running activities and recent tasks
dumpsys activity -p <package_name> activities | grep -E "mResumedActivity" Prints current app’s resumed activity
dumpsys activity -p <package_name> services Provides list of services running for the given package
dumpsys activity -p <package_name> providers Provides list of current content providers for the given package
dumpsys activity -p <package_name> recents Provides list of recent tasks for the given package
dumpsys activity -p <package_name> broadcasts Provides list of broadcast states for the given package
dumpsys activity -p <package_name> intents Provides list of pending intents for the given package
dumpsys activity -p <package_name> permissions Provides list of permissions for the given package
dumpsys activity -p <package_name> processes Provides list of running processes for the given package

Get system and device properties using getprop commands

The getprop commands can be used to get system and device properties such as Sim Operator, device model, Android version etc.

The following table lists all the getprop commands that can be called in an App Live session:

Command Description
getprop -T Provides a list of system property types
getprop gsm.sim.operator.alpha Provides SIM Operator
getprop ro.build.version.release Provides device android version
getprop ro.boot.wifimacaddr Provides the WiFi Mac Address
getprop ro.product.manufacturer Provides Android device manufacturer details
getprop ro.vendor.product.model Provides Android device product number
getprop ro.board.platform Provides Soc info
getprop ro.oem_unlock_supported Provides OEM unlock status
getprop ro.vendor.product.model Provides device model
getprop ro.bootimage.build.fingerprint Provides Android device build fingerprint
getprop ro.cdma.home.operator.alpha Provides SIM operator name
getprop ro.system.build.version.sdk Provides API level
Important: getprop -T command can only be used on Android devices with version 8.1 and above.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle