How can I get Battery information in my app?
Question
I tried to use a receiver to get Information about battery when received a system broadcast, but it failed without doing anything.
Here is the code:
if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction()))
{//doing
1...
}
and in AndroidManifest.xml
<receiver android:name=".BroadCastReceiver_battery">
<intent-filter>
<action android:name="android.intent.action.BATTERY_CHANGED" />
</intent-filter>
</receiver>
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow