简体   繁体   中英

How to send an android system intent?

Because of the bug described here i want to write a little android 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

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.

Sending ACTION_BATTERY_CHANGED will not affect the charging, even if you could broadcast it yourself, which only the firmware can do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM