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>

Was it helpful?

Solution

quasharou ,

I found this tutorial useful

Hope it helps .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top