问题
I found that in the manifest can not be registered (intent-filter battery low, battery changed). I need to get the notification when the battery is fully charged. when I have a running app so it is working, but when I close the application so it does not work. I need the receiver to run in the background when the application is closed.
Main.class
IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
mContext.registerReceiver(this.batteryInfoReceiver,filter);
private BroadcastReceiver batteryInfoReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent)
{
...
}
来源:https://stackoverflow.com/questions/22045625/battery-receiver-fully-charged-doesnt-work