unable to run service when Date changes using broadcast receiver

后端 未结 1 1074
天命终不由人
天命终不由人 2021-01-25 18:47

I create an birthday reminder app. I want to start service at 12:00 in night to scan birthdays of person in Database. I add a broadcast receiver.



        
1条回答
  •  清酒与你
    2021-01-25 19:36

    1. create receiver in Manifest
    
        
             
        
      
    
    1. create BroadcastReceiver class
    public class MyReceiver extends BroadcastReceiver {
           @Override
              public void onReceive(Context context, Intent intent) {
                 if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED)) {
                    Log.e("", "ACTION_DATE_CHANGED received");
                 }
             }
        }
    

    100% working

    0 讨论(0)
提交回复
热议问题