battery receiver fully charged doesnt work

风格不统一 提交于 2020-01-06 04:43:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!