I want to write a program to detect any external device with which my android phone is connected. eg if I connect to computer to share though usb mass storage or if I connect for charging.
Which API or package in android is responsible for hardware interfaces. How can I detect any of external device if connected to my android phone.