How to stop an android device from being charged programmatically?

后端 未结 9 735
醉酒成梦
醉酒成梦 2020-12-23 13:20

Is there an Android API for stop charging even though physically the charging is on?

9条回答
  •  猫巷女王i
    2020-12-23 13:54

    This is unfortunately not possible. Android only have read APIs for battery data.

    Battery charging control is internal to the Android kernel and battery IC modules. Manufacturers do change it from time to time, like HTC is having small cycles from 95-100% (a bad idea IMO), Samsung does stop charges as soon as it reaches 100%, but I've never seen a device able to stop charging before 100% to reduce battery aging :(.

    At best if we're lucky, a sysfs interface might help do that, but it requires root and will differ from device to device.

提交回复
热议问题