Android Battery_property_energy_counter Returning Fixed Value?
My app is runnning code bellow in a working thread every 5 seconds. But it returns a fixed value of -9223372036854775808/ Am I missiging anything? BatteryManager batteryManager
Solution 1:
Android 4.4_r1 removed the possibility for apps to request for the BATTERY_INFO permission as stated in this commit.
You have to:
- ROOT your device
- Download and install the Xposed installer
- Install the “Framework" in the "Xposed Installer" and activate "Enable BatteryStats Permission" in "Modules".
- Reboot your device
Since now you have unlocked root permissions, you can access to BATTERY_STATS permission.
Solution 2:
I'm not sure but you might required
<uses-permission android:name="android.permission.BATTERY_STATS" />
permission.BatteryManager.BATTERY_PROPERTY_ENERGY_COUNTER
isint
notlong
. TrybatteryManager.getIntProperty()
Return the value of a battery property of long type If the platform does not provide the property queried, this value will be Long.MIN_VALUE
So maybe the property is just unavailable. If so, try on a different device.
Post a Comment for "Android Battery_property_energy_counter Returning Fixed Value?"