| Start | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Granting & revoking API 23+ permissions A one-liner that helps granting or revoking vulnerable permissions. |
||||||||||||
| Send text, key pressed and touch events to Android Device via ADB execute the following command to insert the text into a view with a focus (if it supports text input) Send text on SDK 23+ If already connected to your device via Send text prior to SDK 23 Spaces are not accepted as the input, replace them with %s. Send events To simulate pressing the hardware power key or alternatively Even if you don't have a hardware key you still can use a Send touch event as input Send swipe event as input *DURATION is optional, default=300ms. source (opens new window) Get X and Y points by enabling pointer location in developer option. ADB sample shell script To run a script in Ubuntu, Create script.sh right click the file and add read/write permission and tick allow executing file as program. Open terminal emulator and run the command ./script.sh Script.sh For a comprehensive list of event numbers
|
||||||||||||
| List packages Prints all packages, optionally only those whose package name contains the text in Attributes:
Attributes that filter:
|
||||||||||||
| Recording the display Recording the display of devices running Android 4.4 (API level 19) and higher: (press Ctrl-C to stop recording) Download the file from the device: Note: Stop the screen recording by pressing Ctrl-C, otherwise the recording stops automatically at three minutes or the time limit set by Sets the video size: 1280x720. The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder. Sets the video bit rate for the video, in megabits per second. The default value is 4Mbps. You can increase the bit rate to improve video quality, but doing so results in larger movie files. The following example sets the recording bit rate to 5Mbps: Sets the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes). Rotates the output 90 degrees. This feature is experimental. Displays log information on the command-line screen. If you do not set this option, the utility does not display any information while running. Note: This might not work on some devices. The screen recording command isn't compatible with android versions pre 4.4 The screenrecord command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file. |
||||||||||||
| Set Date/Time via adb Default SET format is For example, to set July 17'th 10:10am, without changing the current year, type: Tip 1: the date change will not be reflected immediately, and a noticable change will happen only after the system clock advances to the next minute. Tip 2: to synchronize Android's clock with your local machine: Linux: Windows (PowerShell): Both tips together: Default SET format is 'YYYYMMDD.HHmmss' Tip: to synchronize Android's clock with your local (linux based) machine: |
||||||||||||
Open Developer Options Will navigate your device/emulator to the |
||||||||||||
| Print application data This command print all relevant application data:
|
||||||||||||
| Changing file permissions using chmod command Notice, that in order to change file prmissions, your device need to be rooted, Convention: Numeric permission constructed from user, group and world sections. For example, if you want to change file to be readable, writable and executable by everyone, this will be your command: Or if you intent to deny any permissions to it. 1st digit-specifies user permission, 2nd digit- specifies group permission, 3rd digit - specifies world (others) permission. Access permissions: |
||||||||||||
| Generating a "Boot Complete" broadcast This is relevant for apps that implement a (replace |
||||||||||||
| View external/secondary storage content View content: View path: |
||||||||||||
| kill a process inside an Android device Sometimes Android's logcat is running infinitely with errors coming from some process not own by you, draining battery or just making it hard to debug your code. A convenient way to fix the problem without restarting the device is to locate and kill the process causing the problem. From Logcat
notice the process number: 1550 Now we can open a shell and kill the process.
Note that we cannot kill inside the shell we can check more about the process using and kill it if we want: Syntax
Parameters
|
Read Article
https://develop.horje.com/learn/1434/reference