- Configuring Your System to Detect Your Android Device
- Troubleshooting
- Set Up Device for Development
- Enable Debugging on the Device
- Android 9.0+
- Android 8.0 and Android 8.1
- Android 7.1 and lower
- Verify that USB debugging is enabled
- Android 9.0+
- Android 8.0 and Android 8.1
- Android 7.1 and lower
- Connect the device to the computer
- Alternate connection via Wifi
- Connecting over WiFi
- Troubleshooting
- Install USB Drivers
- Download the USB Drivers
- Installing the USB Driver
- Summary
- Android Debug Bridge (adb)
- How adb works
- Enable adb debugging on your device
- Connect to a device over Wi-Fi (Android 11+)
- Connect to a device over Wi-Fi (Android 10 and lower)
- Query for devices
- Emulator not listed
- Send commands to a specific device
- Install an app
- Set up port forwarding
- Copy files to/from a device
- Stop the adb server
- Issuing adb commands
- Issue shell commands
- Call activity manager ( am )
- Specification for intent arguments
- Call package manager ( pm )
- Call device policy manager ( dpm )
- Take a screenshot
- Record a video
- Read ART profiles for apps
- Reset test devices
- sqlite
Configuring Your System to Detect Your Android Device
In the Project Manager, the Target node located inside the Android target platform node lists any Android device that is connected to your system via USB cable and has been enabled for USB debugging.
To install and configure your Android device:
- Install the USB driver for your Android device.
- Enable USB debugging on your Android device.
- If necessary, install the Android development tools (JDK/SDK/NDK). These libraries are installed by default by the RAD Studio installer.
- Add your Android SDK to the RAD Studio SDK Manager.
- Connect your Android device to your development system using the USB cable provided with your device.
- At the AutoPlay prompt, select Open device to view files.
- In the Control Panel, search for and select «update device drivers».
- In the system Device Manager:
- Your Android device should be listed under Portable Devices. Locate and right-click your Android device, and select Update Software Driver.
- Browse to the \extras folder in your installed directory, and select the folder that matches your Android device. Then click OK. For example, select google for the Nexus 7 or Nexus 10 tablet. If you do not find a folder for your Android device, see Installing the USB Driver for Your Android Device.
- Verify that your Android device is now:
- Listed in Windows Explorer, below the system disk drives, along with your mapped network drives.
- Displayed in the Target node in the Project Manager.
Troubleshooting
If your device is not correctly detected in RAD Studio or in the system Device Manager, check the following:
- Ensure that your Android device is unlocked and not sleeping while connected via USB. Set the appropriate option in Settings or Developer Options.
- Make sure your Android device is enabled for USB debugging. On many Android devices, you can verify whether USB debugging is enabled by visiting the Settings|Developer Options page.
- Install the USB driver for your Android device.
- If the battery in your Android device gets exhausted, first recharge the battery and then install the USB driver again.
- If your Android device was previously shown in RAD Studio but is not shown now, try uninstalling the USB driver, disconnecting the device, reinstalling the USB driver, and then reconnecting the device. Also revisit your device settings and verify that USB debugging is enabled on your device, and the device is set to stay awake while connected to USB.
- For more information, see:
- http://developer.android.com/sdk/win-usb.html (Google USB Drivers)
- https://developer.amazon.com/sdk/fire/connect-adb.html (Kindle Fire USB Drivers)
- http://developer.android.com/tools/extras/oem-usb.html (OEM USB Drivers)
- In your system Device Manager, click the
Scan for Hardware Changes button (or right-click your computer name and select Scan for hardware changes).
- If you are running KIES, quit this application while working with RAD Studio. KIES conflicts with the underlying software that RAD Studio uses to detect Android devices.
- If you are using a Kindle Fire, see Installing SDK Add-Ons in the Amazon documentation to configure your system to detect your device.
Источник
Set Up Device for Development
This article explains how to setup an Android device and connect it to a computer so that the device may be used to run and debug Xamarin.Android applications.
After testing on an Android emulator, you will want to see and test your apps running on an Android device. You will need to enable debugging and connect the device to the computer.
Each of these steps will be covered in more detail in the sections below.
Enable Debugging on the Device
A device must be enabled for debugging in order to test an Android application. Developer options on Android have been hidden by default since version 4.2, and enabling them can vary based on the Android version.
Android 9.0+
For Android 9.0 and higher, debugging is enabled by following these steps:
- Go to the Settings screen.
- Select About Phone .
- Tap Build Number 7 times until You are now a developer! is visible.
Android 8.0 and Android 8.1
- Go to the Settings screen.
- Select System.
- Select About Phone
- Tap Build Number 7 times until You are now a developer! is visible.
Android 7.1 and lower
- Go to the Settings screen.
- Select About Phone.
- Tap Build Number 7 times until You are now a developer! is visible.
Verify that USB debugging is enabled
After enabling developer mode on your device, you must ensure that USB debugging is enabled on the device. This also varies based on the Android version.
Android 9.0+
Navigate to Settings > System > Advanced > Developer Options and enable USB Debugging.
Android 8.0 and Android 8.1
Navigate to Settings > System > Developer Options and enable USB Debugging.
Android 7.1 and lower
Navigate to Settings > Developer Options and enable USB Debugging.
Once the Developer Options tab is available under Settings > System, open it to reveal developer settings:
This is the place to enable developer options such as USB debugging and stay awake mode.
Connect the device to the computer
The final step is to connect the device to the computer. The easiest and most reliable way is to do so over USB.
You will receive a prompt to trust the computer on your device if you have not used it for debugging before. You can also check Always allow from this computer to prevent requiring this prompt each time you connect the device.
Alternate connection via Wifi
It is possible to connect an Android device to a computer without using a USB cable, over WiFi. This technique requires more effort but could be useful when the device is too far from the computer to remain constantly plugged-in via cable.
Connecting over WiFi
By default, the Android Debug Bridge (ADB) is configured to communicate with an Android device via USB. It is possible to reconfigure it to use TCP/IP instead of USB. To do this, both the device and the computer must be on the same WiFi network. To setup your environment to debug over WiFi complete the following steps from the command line:
Determine the IP address of your Android device. One way to find out the IP address is to look under Settings > Network & internet > Wi-Fi, then tap on the WiFi network that the device is connected to, and then tap on Advanced. This will open a dropdown showing information about the network connection, similar to what is seen in the screenshot below:
On some versions of Android the IP address won’t be listed there but can be found instead under Settings > About phone > Status.
Connect your Android device to your computer via USB.
Next, restart ADB so that it using TCP on port 5555. From a command prompt, type the following command:
After this command is issued, your computer will not be able to listen to devices that are connected via USB.
Disconnect the USB cable connecting your device to your computer.
Configure ADB so that it will connect to your Android device on the port that was specified in step 1 above:
Once this command finishes the Android device is connected to the computer via WiFi.
When you’re finished debugging via WiFi, it’s possible to reset ADB back to USB mode with the following command:
It’s possible to request ADB to list the devices that are connected to the computer. Regardless of how the devices are connected, you can issue the following command at the command prompt to see what is connected:
Troubleshooting
In some cases you might find that your device cannot connect to the computer. In this case you may want to verify that USB drivers are installed.
Install USB Drivers
This step is not necessary for macOS; just connect the device to the Mac with a USB cable.
It may be necessary to install some extra drivers before a Windows computer will recognize an Android device connected by USB.
These are the steps to set up a Google Nexus device and are provided as a reference. Steps for your specific device may vary, but will follow a similar pattern. Search the internet for your device if you have trouble.
Run the android.bat application in the [Android SDK install path]\tools directory. By default, the Xamarin.Android installer will put the Android SDK in following location on a Windows computer:
Download the USB Drivers
Google Nexus devices (with the exception of the Galaxy Nexus) require the Google USB Driver. The driver for the Galaxy Nexus is distributed by Samsung. All other Android devices should use the USB driver from their respective manufacturer.
Install the Google USB Driver package by starting the Android SDK Manager, and expanding the Extras folder, as can be seen in the follow screenshot:
Check the Google USB Driver box, and click the Apply Changes button. The driver files are downloaded to the following location:
[Android SDK install path]\extras\google\usb\_driver
The default path for a Xamarin.Android installation is:
Installing the USB Driver
After the USB drivers are downloaded, it is necessary to install them. To install the drivers on Windows 7:
Connect your device to the computer with a USB cable.
Right-click on the Computer from your desktop or Windows Explorer, and select Manage .
Select Devices in the left pane.
Locate and expand Other Devices in the right pane.
Right-click the device name and select Update Driver Software . This will launch the Hardware Update Wizard.
Select Browse my computer for driver software and click Next .
Click Browse and locate the USB driver folder (the Google USB driver is located in [Android SDK install path]\extras\google\usb_driver).
Click Next to install the driver.
Summary
This article discussed how to configure an Android device for development by enabling debugging on the device. It also covered how to connect the device to a computer using either USB or WiFi.
Источник
Android Debug Bridge (adb)
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:
- A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
- A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
- A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.
adb is included in the Android SDK Platform-Tools package. You can download this package with the SDK Manager, which installs it at android_sdk /platform-tools/ . Or if you want the standalone Android SDK Platform-Tools package, you can download it here.
For information on connecting a device for use over ADB, including how to use the Connection Assistant to troubleshoot common problems, see Run apps on a hardware device.
How adb works
When you start an adb client, the client first checks whether there is an adb server process already running. If there isn’t, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server.
The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, the range used by the first 16 emulators. Where the server finds an adb daemon (adbd), it sets up a connection to that port. Note that each emulator uses a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb connections. For example:
Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and so on.
As shown, the emulator connected to adb on port 5555 is the same as the emulator whose console listens on port 5554.
Once the server has set up connections to all devices, you can use adb commands to access those devices. Because the server manages connections to devices and handles commands from multiple adb clients, you can control any device from any client (or from a script).
Enable adb debugging on your device
To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. To use adb with a device connected over Wi-Fi, see Connect to a device over Wi-Fi.
On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
On some devices, the Developer options screen might be located or named differently.
You can now connect your device with USB. You can verify that your device is connected by executing adb devices from the android_sdk /platform-tools/ directory. If connected, you’ll see the device name listed as a «device.»
Note: When you connect a device running Android 4.2.2 or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you’re able to unlock the device and acknowledge the dialog.
For more information about connecting to a device over USB, read Run Apps on a Hardware Device.
Connect to a device over Wi-Fi (Android 11+)
Android 11 and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB. This eliminates the need to deal with common USB connection issues, such as driver installation.
To use wireless debugging, you need to pair your device to your workstation using a pairing code. Your workstation and device must be connected to the same wireless network. To connect to your device, follow these steps:
- On your workstation, update to the latest version of the SDK Platform-Tools.
- On the device, enable developer options.
- Enable the Wireless debugging option.
- On the dialog that asks Allow wireless debugging on this network?, click Allow.
- Select Pair device with pairing code. Take note of the pairing code, IP address, and port number displayed on the device (see image).
- On your workstation, open a terminal and navigate to android_sdk /platform-tools .
- Run adb pair ipaddr : port . Use the IP address and port number from step 5.
- When prompted, enter the pairing code that you received in step 5. A message indicates that your device has been successfully paired.
- (For Linux or Microsoft Windows only) Run adb connect ipaddr : port . Use the IP address and port under Wireless debugging.
Connect to a device over Wi-Fi (Android 10 and lower)
adb usually communicates with the device over USB, but you can also use adb over Wi-Fi given the following:
- To connect to a device running Android 11 (and later), see the Wi-Fi section in Run Apps on a Hardware Device.
- To connect to a device running earlier versions of Android, there are some initial steps you must do over USB. These steps are described below.
- If you’re developing for Wear OS, see the guide to debugging a Wear OS app, which has special instructions for using adb with Wi-Fi and Bluetooth.
- Connect your Android device and adb host computer to a common Wi-Fi network accessible to both. Beware that not all access points are suitable; you might need to use an access point whose firewall is configured properly to support adb.
- If you are connecting to a Wear OS device, turn off Bluetooth on the phone that’s paired with the device.
- Connect the device to the host computer with a USB cable.
- Set the target device to listen for a TCP/IP connection on port 5555.
- Disconnect the USB cable from the target device.
- Find the IP address of the Android device. For example, on a Nexus device, you can find the IP address at Settings >About tablet (or About phone) >Status >IP address. Or, on a Wear OS device, you can find the IP address at Settings >Wi-Fi Settings >Advanced >IP address.
- Connect to the device by its IP address.
- Confirm that your host computer is connected to the target device:
You’re now good to go!
If the adb connection is ever lost:
- Make sure that your host is still connected to the same Wi-Fi network your Android device is.
- Reconnect by executing the adb connect step again.
- Or if that doesn’t work, reset your adb host:
Then start over from the beginning.
Query for devices
Before issuing adb commands, it is helpful to know what device instances are connected to the adb server. You can generate a list of attached devices using the devices command.
In response, adb prints this status information for each device:
- Serial number: A string created by adb to uniquely identify the device by its port number. Here’s an example serial number: emulator-5554
- State: The connection state of the device can be one of the following:
- offline : The device is not connected to adb or is not responding.
- device : The device is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational because the device connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an device.
- no device : There is no device connected.
- Description: If you include the -l option, the devices command tells you what the device is. This information is helpful when you have multiple devices connected so that you can tell them apart.
The following example shows the devices command and its output. There are three devices running. The first two lines in the list are emulators, and the third line is a hardware device that is attached to the computer.
Emulator not listed
The adb devices command has a corner-case command sequence that causes running emulator(s) to not show up in the adb devices output even though the emulator(s) are visible on your desktop. This happens when all of the following conditions are true:
- The adb server is not running, and
- You use the emulator command with the -port or -ports option with an odd-numbered port value between 5554 and 5584, and
- The odd-numbered port you chose is not busy so the port connection can be made at the specified port number, or if it is busy, the emulator switches to another port that meets the requirements in 2, and
- You start the adb server after you start the emulator.
One way to avoid this situation is to let the emulator choose its own ports, and don’t run more than 16 emulators at once. Another way is to always start the adb server before you use the emulator command, as explained in the following examples.
Example 1: In the following command sequence, the adb devices command starts the adb server, but the list of devices does not appear.
Stop the adb server and enter the following commands in the order shown. For the avd name, provide a valid avd name from your system. To get a list of avd names, type emulator -list-avds . The emulator command is in the android_sdk /tools directory.
Example 2: In the following command sequence, adb devices displays the list of devices because the adb server was started first.
To see the emulator in the adb devices output, stop the adb server, and then start it again after using the emulator command and before using the adb devices command, as follows:
For more information about emulator command-line options, see Using Command Line Parameters.
Send commands to a specific device
If multiple devices are running, you must specify the target device when you issue the adb command. To specify the target, use the devices command to get the serial number of the target. Once you have the serial number, use the -s option with the adb commands to specify the serial number. If you’re going to issue a lot of adb commands, you can set the $ANDROID_SERIAL environment variable to contain the serial number instead. If you use both -s and $ANDROID_SERIAL , -s overrides $ANDROID_SERIAL .
In the following example, the list of attached devices is obtained, and then the serial number of one of the devices is used to install the helloWorld.apk on that device.
Note: If you issue a command without specifying a target device when multiple devices are available, adb generates an error.
If you have multiple devices available, but only one is an emulator, use the -e option to send commands to the emulator. Likewise, if there are multiple devices but only one hardware device attached, use the -d option to send commands to the hardware device.
Install an app
You can use adb to install an APK on an emulator or connected device with the install command:
You must use the -t option with the install command when you install a test APK. For more information, see -t .
For more information about how to create an APK file that you can install on an emulator/device instance, see Build and Run Your App.
Note that, if you are using Android Studio, you do not need to use adb directly to install your app on the emulator/device. Instead, Android Studio handles the packaging and installation of the app for you.
Set up port forwarding
You can use the forward command to set up arbitrary port forwarding, which forwards requests on a specific host port to a different port on a device. The following example sets up forwarding of host port 6100 to device port 7100:
The following example sets up forwarding of host port 6100 to local:logd:
Copy files to/from a device
Use the pull and push commands to copy files to and from an device. Unlike the install command, which only copies an APK file to a specific location, the pull and push commands let you copy arbitrary directories and files to any location in a device.
To copy a file or directory and its sub-directories from the device, do the following:
To copy a file or directory and its sub-directories to the device, do the following:
Replace local and remote with the paths to the target files/directory on your development machine (local) and on the device (remote). For example:
Stop the adb server
In some cases, you might need to terminate the adb server process and then restart it to resolve the problem (e.g., if adb does not respond to a command).
To stop the adb server, use the adb kill-server command. You can then restart the server by issuing any other adb command.
Issuing adb commands
You can issue adb commands from a command line on your development machine or from a script. The usage is:
If there’s only one emulator running or only one device connected, the adb command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you need to use the -d , -e , or -s option to specify the target device to which the command should be directed.
You can see a detailed list of all supported adb commands using the following command:
Issue shell commands
You can use the shell command to issue device commands through adb, or to start an interactive shell. To issue a single command use the shell command like this:
To start an interactive shell on a device use the shell command like this:
To exit an interactive shell, press Control + D or type exit .
Note: With Android Platform-Tools 23 and higher, adb handles arguments the same way that the ssh(1) command does. This change has fixed a lot of problems with command injection and makes it possible to now safely execute commands that contain shell metacharacters, such as adb install Let\’sGo.apk . But, this change means that the interpretation of any command that contains shell metacharacters has also changed. For example, the adb shell setprop foo ‘a b’ command is now an error because the single quotes ( ‘ ) are swallowed by the local shell, and the device sees adb shell setprop foo a b . To make the command work, quote twice, once for the local shell and once for the remote shell, the same as you do with ssh(1) . For example, adb shell setprop foo «‘a b'» .
Android provides most of the usual Unix command-line tools. For a list of available tools, use the following command:
Help is available for most of the commands via the —help argument. Many of the shell commands are provided by toybox. General help applicable to all toybox commands is available via toybox —help .
See also Logcat Command-Line Tool which is useful for monitoring the system log.
Call activity manager ( am )
Within an adb shell, you can issue commands with the activity manager ( am ) tool to perform various system actions, such as start an activity, force-stop a process, broadcast an intent, modify the device screen properties, and more. While in a shell, the syntax is:
You can also issue an activity manager command directly from adb without entering a remote shell. For example:
Table 2. Available activity manager commands
Command | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
start [ options ] intent | Start an Activity specified by intent . Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
startservice [ options ] intent | Start the Service specified by intent . Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
force-stop package | Force stop everything associated with package (the app’s package name). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kill [ options ] package | Kill all processes associated with package (the app’s package name). This command kills only processes that are safe to kill and that will not impact the user experience. Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kill-all | Kill all background processes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
broadcast [ options ] intent | Issue a broadcast intent. Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
instrument [ options ] component | Start monitoring with an Instrumentation instance. Typically the target component is the form test_package / runner_class . Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
profile start process file | Start profiler on process , write results to file . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
profile stop process | Stop profiler on process . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dumpheap [ options ] process file | Dump the heap of process , write to file . Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
set-debug-app [ options ] package | Set app package to debug. Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
clear-debug-app | Clear the package previous set for debugging with set-debug-app . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
monitor [ options ] | Start monitoring for crashes or ANRs. Options are:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
screen-compat | Control screen compatibility mode of package . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display-size [reset | width x height ] | Override device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa. Example: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display-density dpi | Override device display density. This command is helpful for testing your app across different screen densities on high-density screen environment using a low density screen, and vice versa. Example: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
to-uri intent | Print the given intent specification as a URI. See the Specification for intent arguments. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
to-intent-uri intent | Print the given intent specification as an intent: URI. Specification for intent argumentsFor activity manager commands that take an intent argument, you can specify the intent with the following options: -a action Specify the intent action, such as android.intent.action.VIEW . You can declare this only once. -d data_uri Specify the intent data URI, such as content://contacts/people/1 . You can declare this only once. -t mime_type Specify the intent MIME type, such as image/png . You can declare this only once. -c category Specify an intent category, such as android.intent.category.APP_CONTACTS . -n component Specify the component name with package name prefix to create an explicit intent, such as com.example.app/.ExampleActivity . -f flags Add flags to the intent, as supported by setFlags() . —esn extra_key Add a null extra. This option is not supported for URI intents. -e | —es extra_key extra_string_value Add string data as a key-value pair. —ez extra_key extra_boolean_value Add boolean data as a key-value pair. —ei extra_key extra_int_value Add integer data as a key-value pair. —el extra_key extra_long_value Add long data as a key-value pair. —ef extra_key extra_float_value Add float data as a key-value pair. —eu extra_key extra_uri_value Add URI data as a key-value pair. —ecn extra_key extra_component_name_value Add a component name, which is converted and passed as a ComponentName object. —eia extra_key extra_int_value [, extra_int_value . ] Add an array of integers. —ela extra_key extra_long_value [, extra_long_value . ] Add an array of longs. —efa extra_key extra_float_value [, extra_float_value . ] Add an array of floats. —grant-read-uri-permission Include the flag FLAG_GRANT_READ_URI_PERMISSION . —grant-write-uri-permission Include the flag FLAG_GRANT_WRITE_URI_PERMISSION . —debug-log-resolution Include the flag FLAG_DEBUG_LOG_RESOLUTION . —exclude-stopped-packages Include the flag FLAG_EXCLUDE_STOPPED_PACKAGES . —include-stopped-packages Include the flag FLAG_INCLUDE_STOPPED_PACKAGES . —activity-brought-to-front Include the flag FLAG_ACTIVITY_BROUGHT_TO_FRONT . —activity-clear-top Include the flag FLAG_ACTIVITY_CLEAR_TOP . —activity-clear-when-task-reset Include the flag FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET . —activity-exclude-from-recents Include the flag FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS . —activity-launched-from-history Include the flag FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY . —activity-multiple-task Include the flag FLAG_ACTIVITY_MULTIPLE_TASK . —activity-no-animation Include the flag FLAG_ACTIVITY_NO_ANIMATION . —activity-no-history Include the flag FLAG_ACTIVITY_NO_HISTORY . —activity-no-user-action Include the flag FLAG_ACTIVITY_NO_USER_ACTION . —activity-previous-is-top Include the flag FLAG_ACTIVITY_PREVIOUS_IS_TOP . —activity-reorder-to-front Include the flag FLAG_ACTIVITY_REORDER_TO_FRONT . —activity-reset-task-if-needed Include the flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED . —activity-single-top Include the flag FLAG_ACTIVITY_SINGLE_TOP . —activity-clear-task Include the flag FLAG_ACTIVITY_CLEAR_TASK . —activity-task-on-home Include the flag FLAG_ACTIVITY_TASK_ON_HOME . —receiver-registered-only Include the flag FLAG_RECEIVER_REGISTERED_ONLY . —receiver-replace-pending Include the flag FLAG_RECEIVER_REPLACE_PENDING . —selector Requires the use of -d and -t options to set the intent data and type. URI component package You can directly specify a URI, package name, and component name when not qualified by one of the above options. When an argument is unqualified, the tool assumes the argument is a URI if it contains a «:» (colon); it assumes the argument is a component name if it contains a «/» (forward-slash); otherwise it assumes the argument is a package name. Call package manager ( pm )Within an adb shell, you can issue commands with the package manager ( pm ) tool to perform actions and queries on app packages installed on the device. While in a shell, the syntax is: You can also issue a package manager command directly from adb without entering a remote shell. For example: Table 3. Available package manager commands.
Call device policy manager ( dpm )To help you develop and test your device management (or other enterprise) apps, you can issue commands to the device policy manager ( dpm ) tool. Use the tool to control the active admin app or change a policy’s status data on the device. While in a shell, the syntax is: You can also issue a device policy manager command directly from adb without entering a remote shell: Table 4. Available device policy manager commands
|