Bucks
Bucks

Reputation: 687

External Hardware Info

is there is any possibility to check what are the external hardware where connected in computer

Getting the status of each hardware is online or offline

Upvotes: 5

Views: 905

Answers (3)

Vishal Pawar
Vishal Pawar

Reputation: 4340

You may have to take help of linux kernel so I think just execute one simple command that can give you list of devices connected to your device

Here it is

Process process = Runtime.getRuntime().exec("cat /proc/devices");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));

or you can use udevinfo I dont know in details about it but google is there for you

Upvotes: 2

Code Rebel
Code Rebel

Reputation: 423

If you have honeycomb or above use the USB Manager Service

    UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
    HashMap<String, UsbDevice> devices = manager.getDeviceList();

Upvotes: 2

Peter Lawrey
Peter Lawrey

Reputation: 533530

To do this you need to run an external program using Runtime.exec().

There are plenty of examples of how to do this for Windows and Unix, but for Android I suspect another command is required.

Upvotes: 0

Related Questions