From ecc958df24fb705f3822dbe0ccbba02652c4a179 Mon Sep 17 00:00:00 2001 From: p6zpjanrb <1157949412@qq.com> Date: Thu, 14 Dec 2023 09:55:01 +0800 Subject: [PATCH] Update AlarmReceiver.java --- src/net/micode/notes/ui/AlarmReceiver.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/net/micode/notes/ui/AlarmReceiver.java b/src/net/micode/notes/ui/AlarmReceiver.java index 54e503b..981a59a 100644 --- a/src/net/micode/notes/ui/AlarmReceiver.java +++ b/src/net/micode/notes/ui/AlarmReceiver.java @@ -24,7 +24,12 @@ public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { intent.setClass(context, AlarmAlertActivity.class); + //启动AlarmAlertActivity intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + //activity要存在于activity的栈中,而非activity的途径启动activity时必然不存在一个activity的栈 + //所以要新起一个栈装入启动的activity context.startActivity(intent); } } +//这是实现alarm这个功能最接近用户层的包,基于上面的两个包, +//作用还需要深究但是对于setClass和addFlags的 \ No newline at end of file