Android 系统发送“系统当前时间”的广播

系统每分钟都会发送广播Intent.ACTION_TIME_TICK

静态注册广播
IntentFilter filter=new IntentFilter();
filter.addAction(Intent.ACTION_TIME_TICK);
registerReceiver(receiver,filter);

接收广播
private final BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(Intent.ACTION_TIME_TICK)) {

            }
        }
    };

你可能感兴趣的:(andriod)