Charging an Android Device

623 views Asked by At

Is there a possibility to change the battery level programmatically, I mean to charge it programatically by myself or is it a system call(android sees that a power device is connected and charges)?

I have the following use case:

There is one output(micro usb) that is connected to a usb hub with a possibility to connect many usb devices, one of that devices should be a power device.

I can see programmatically all the devices connected to my phone, but I cant realize at the moment how can i programmatically say the android: please charge from that usb device.

Is it a system call and I require the source code of the android os to be modified in the right way? I have already downloaded source code from https://source.android.com/ and run the make on these code, but can't get it to the eclipse - exceptions raised due to lack of resources :-)

Is it possible to completely remove the android os from a device and get a modified version by my own on it?

Thank you for all advices

1

There are 1 answers

2
gtsouk On BEST ANSWER

Usb devices draw power from the usb host. When you connect peripherals to your phone it acts as a usb host. In that case the peripheral device draws power from your phone and not the other way.

I don't think a usb host can draw power from a device.