USB management
Introduction
This example demonstrates the use of USB device management, including USB device insertion and removal status monitoring and USB device information display. The results are as follows:

Related Conceptions
-
Subscribe to USB Listening Events : Obtain the interface usage status by subscribing to the USB insertion and removal listening events.
-
Get USB Device List: Gets the list of plugged in USB devices.
Related permissions
Not involved
Usage
-
Open the USB Listening switch, and the interface pops up the prompt of "Start Listening...".
-
Plug in the device, the interface will have a "USB plugged in" prompt, the device list will show the plugged in device. If the list is not updated in time, you can manually refresh the drop-down list.
-
Click on the device, the pop-up box will display the specific information of the USB device, click the OK button to return to the main page.
-
Unplug the USB device, the interface will have a "removed device" prompt, and the device list will remove the device model. If the list is not updated in time, you can manually refresh the drop-down list.
Constraints and Restrictions
-
This sample is only supported to run on standard systems.
-
This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.