You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
software/AlarmReceiver.txt

25 lines
779 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 闹钟接收器,用于处理闹钟提醒的广播。
*/
public class AlarmReceiver extends BroadcastReceiver {
/**
* 接收到广播时调用。
* @param context 上下文对象,提供了与应用程序交互的信息。
* @param intent 包含广播信息的数据。
*/
@Override
public void onReceive(Context context, Intent intent) {
// 将接收到的Intent的目标设置为AlarmAlertActivity类
intent.setClass(context, AlarmAlertActivity.class);
// 为Intent添加标记表示需要创建一个新的任务栈
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 启动AlarmAlertActivity活动显示闹钟提醒
context.startActivity(intent);
}
}