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.
xiaomi-Notes/AlarmReceiver.java

37 lines
1.4 KiB

5 months ago
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* 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;
// 指定当前类所在的包名
import android.content.BroadcastReceiver; // 导入广播接收器基类
import android.content.Context; // 导入上下文类
import android.content.Intent; // 导入意图类
// 定义AlarmReceiver类继承自BroadcastReceiver
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);
// 启动AlarmAlertActivity
context.startActivity(intent);
}
}