How to send an android system intent?
Because of the bug described here i want to write a little an开发者_Python百科droid app to fix the problem in an indirect approach.
I want to write a program that disconnect and reconnect the charger programmatically.
I am new to java and to android applications ( although i know very well c,c++,C#).
from here i am not sure i am on the right way, so i will be happy to hear another solution. the one i came up with is to send an intent called BATTERY_CHANGED as described here.
i quote: "This is a protected intent that can only be sent by the system."
I want to send it so the battery state of charging will change (of course, when battery is full) i couldn't "touch" this method, the IDE(eclipse,with sdk, with ADT plugin, on win 7 x64) could not recognize the android.intent.action.BATTERY_CHANGED as an existing value. another two things i thought might be useful: developer.android.com/reference/android/content/Intent.html#ACTION_POWER_CONNECTED developer.android.com/reference/android/content/Intent.html#ACTION_POWER_DISCONNECTED
Sending ACTION_BATTERY_CHANGED
will not affect the charging, even if you could broadcast it yourself, which only the firmware can do.
Speaking generally about rechargeable batteries, especially Lithium containing ones, the charging is NOT controlled by software the user (or developer) can tamper with. This would be way too dangerous as overloading Lithium batteries will cause them to fail catastrophically. MAYBE you could manage to make the charging process stop, but I doubt that.
精彩评论