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.
test-1/AlarmReceiver.java

20 lines
752 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.

package net.micode.notes.ui;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
// 闹钟接收者类,用于接收闹钟触发的广播并启动闹钟提醒活动
public class AlarmReceiver extends BroadcastReceiver {
// 当接收到广播时调用
@Override
public void onReceive(Context context, Intent intent) {
// 设置意图的目标活动为AlarmAlertActivity即闹钟提醒页面
intent.setClass(context, AlarmAlertActivity.class);
// 添加新任务标志,确保活动在新的任务栈中启动
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 启动活动,显示闹钟提醒
context.startActivity(intent);
}
}