|
|
@ -1,30 +1,39 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
|
|
|
* 版权声明,指明代码归属于MiCode开源社区
|
|
|
|
*
|
|
|
|
* 遵循Apache License 2.0协议
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 导入必要的Android类
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 闹钟接收器类,继承自BroadcastReceiver
|
|
|
|
|
|
|
|
* 功能:处理系统闹钟广播,当预设提醒时间到达时触发提醒
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//111111111111111
|
|
|
|
|
|
|
|
// 11111111111
|
|
|
|
public class AlarmReceiver extends BroadcastReceiver {
|
|
|
|
public class AlarmReceiver extends BroadcastReceiver {
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 广播接收处理方法
|
|
|
|
|
|
|
|
* @param context 当前上下文环境(应用上下文)
|
|
|
|
|
|
|
|
* @param intent 接收到的广播意图(包含闹钟信息)
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
|
|
|
|
// 将接收到的意图重定向到闹钟提醒Activity
|
|
|
|
intent.setClass(context, AlarmAlertActivity.class);
|
|
|
|
intent.setClass(context, AlarmAlertActivity.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 添加新的任务栈标识(因为可能从非Activity环境启动Activity)
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 启动闹钟提醒界面Activity
|
|
|
|
context.startActivity(intent);
|
|
|
|
context.startActivity(intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|