Android USB API: switch between downloading and sending data

I am starting to use the Android USB API to send data from Arduino to an Android device. Can I programmatically switch between send and receive data and charge my Android phone?

I know that you cannot do both things at the same time, and since you need to open FileInputStream in order to be able to receive data while it is open, the device will not charge.

Will it be as simple as closing this stream to recharge it? If so simple, can the Arduino send basic information to ask the device to reopen the stream?

+7
source share
1 answer

I'm not sure if I understand your concern or not. You can use OTG at the same time to charge and exchange data via USB. Here is a link from Amazon, I shared: https://www.amazon.com/Micro-Cable-Samsung-Player-OTHERS/dp/B00CXAC1ZW I used it in one of my projects, it works.

0
source

All Articles