|
|
@ -24,7 +24,12 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
intent.setClass(context, AlarmAlertActivity.class);
|
|
|
|
intent.setClass(context, AlarmAlertActivity.class);
|
|
|
|
|
|
|
|
//启动AlarmAlertActivity
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
|
|
|
//activity要存在于activity的栈中,而非activity的途径启动activity时必然不存在一个activity的栈
|
|
|
|
|
|
|
|
//所以要新起一个栈装入启动的activity
|
|
|
|
context.startActivity(intent);
|
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//这是实现alarm这个功能最接近用户层的包,基于上面的两个包,
|
|
|
|
|
|
|
|
//作用还需要深究但是对于setClass和addFlags的
|