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xjBS/PsgJdOhqwtAsO3G5d9tilL6lwplA8V1z6v2x8+MUve/4P3vnwoj/kzgf96ijP/2U/xI98JZ/zgg+bsAuzzWGPnb3zAXPdF5qMH5uvt7TzDfrKS/JRCutj6+zor+QTXvzR7/9pkyXz5f9YJtoXfSVHn3SfPMtlm6w7gExlPv+JnPBk3QFkKvP5T+SEJ+sOIFOZz38iJzxZdwCZynz+EznhyboDyFTm85/ICU/WHUCmMt0Cj0wAAABzSURBVJ//RE54su4AMpX5/CdywpN1B5CpzOc/kROerDuATGU+/4mc8GTdAWQq8/lP5IQn6w4gU5nPfyInPFl3AJnKfP4TOeHJugPIVPjvIUQkk0RrUdYdQLb+lwv/14CIfOXE63Huf1k3AAAAAAAAfAn/BwY6sKkFjZllAAAAAElFTkSuQmCC" alt="" />
2. 实现代码
public class firstActivity extends Activity { private static final String AM_ACTION = "iflab.test.AM_ACTION"; // ACTION常量 @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); Button btn1 = (Button) findViewById(R.id.button1); // 获取对象 final AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);// 获取系统服务
Intent intent = new Intent(); // Intent对象
intent.setAction(AM_ACTION); // 设置Action
intent.putExtra("message", "该下班啦!"); // 传递字符串
final PendingIntent pendingIntent = PendingIntent.getBroadcast(
firstActivity.this, 0, intent, 0);
final long time = System.currentTimeMillis(); // 设置当前时间 btn1.setOnClickListener(new View.OnClickListener() { // 监听器 @Override
public void onClick(View v) {
// TODO Auto-generated method stub
alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent); // 设置单次闹钟提醒
}
});
}
}
firstActivity
public class myReceiver extends BroadcastReceiver{ @Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
String str;
str="触发单次闹钟:"+arg1.getStringExtra("message");
Toast.makeText(arg0, str,Toast.LENGTH_LONG).show(); //显示
}
}
myReceiver
<receiver android:name="myReceiver">
<intent-filter>
<action android:name="iflab.test.AM_ACTION"/>
</intent-filter>
</receiver>
配置文件
Android -- 闹钟服务的使用(单次闹钟)的更多相关文章
- AlarmManager(闹钟服务)
1.Timer类与AlarmManager类区别: 对Timer就是定时器,一般写定时任务的时候 肯定离不开他,但是在Android里,他却有个短板,不太适合那些需要长时间在后台运行的 定时任务,因为 ...
- Android AlarmManager类的应用(实现闹钟功能)
1.AlarmManager,顾名思义,就是“提醒”,是Android中常用的一种系统级别的提示服务,可以实现从指定时间开始,以一个固定的间隔时间执行某项操作,所以常常与广播(Broadcast)连用 ...
- 3D语音天气球(源码分享)——在Unity中使用Android语音服务
转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 开篇废话: 这个项目准备分四部分介绍: 一:创建可旋转的"3D球":3 ...
- Android从服务端获取json解析显示在客户端上面
Android从服务端获取json解析显示在客户端上面 百度经验:jingyan.baidu.com 首先说一下Json数据的最基本的特点,Json数据是一系列的键值对的集合,和XML数据来比,Jso ...
- [Android] Service服务详解以及如何使service服务不被杀死
排版上的细节有些不好看,主要是我用的MarkDown编辑器预览和这里的不一样,在那个上面的样式很舒服.这里要改的地方太多就不想改了,将就看吧.下次写的时候注意.还有看到错误给我提啊. 本文链接:htt ...
- Android 前台服务
Android 前台服务 学习自 https://blog.csdn.net/guolin_blog/article/details/11952435#t3 前台服务漫谈 我们之前学习的Service ...
- Android Service 服务(三)—— bindService与remoteService
(转自:http://blog.csdn.net/ithomer/article/details/7366396) 一.bindService简介 bindService是绑定Service服务, ...
- Android 位置服务——BaiduLocation的使用
原文:Android 位置服务--BaiduLocation的使用 版权声明:本文为博主原创文章,欢迎转载,转载请在文章显眼处说明文章出处并给出连接. https://blog.csdn.net/To ...
- Android 网络服务介绍
1. 介绍 Android网络服务主要包括如下四个部分 - ConnectivityService: 提供数据连接管理服务,包括移动数据.WIFI.以太网等 - NetworkPolicyManage ...
随机推荐
- supervisor使用
supervisor是一个C/S系统,它可以在类unix操作系统让用户来监视和控制后台服务进程的数量,一个很重要的功能就是监控服务器的主要后台进程,并在出现问题是自动重启. 根据服务器上的python ...
- VS2015 Preview Secondary Installer 离线安装
VS2015 Preview Secondary Installer 离线安装 天朝的原因orz, 装过vs2015 preview 的人都懂的,第二阶段安装会失败.假公济私的研究了下VS2015,摸 ...
- html5 简单音乐播放器
html5 简单音乐播放器 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> < ...
- 2-04使用SQL语句创建数据库
下面是创建数据库的一些语法: USE master--指向当前使用的数据库 GO--批处理的标志 CREATE DATABASE E_Market--创建E_market数据库 ON PRMARY-- ...
- SSH Key连接github提示Permission denied (publickey).错误
root@debian64:/home/xiaoliuzi/.ssh/key_backup# ssh -T git@github.com The authenticity of host 'githu ...
- jq中.prop()与attr()的区别
一,定义 prop() 方法设置或返回被选元素的属性和值.prop() 方法应该用于检索属性值 attr() 方法设置或返回被选元素的属性和值.如需检索 HTML 属性,请使用 attr() 方法代 ...
- AJAX案例四:省市联动
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"% ...
- hdu3448 01背包+dfs
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=3448 Description 0/1 bag problem should sound f ...
- express-13 中间件
简介 从概念上讲,中间件是一种功能的封装方式,具体来说就是封装在程序中处理HTTP请求的功能. 中间件是在管道中执行的,在Express程序中,通过调用app.use向管道中插入中间件.(在Expre ...
- dubbox编译
dubbox编译要在命令行 切记切记 设置JAVA_HOME 设置maven路径 命令编译dubbox 设置M2_HOME环境变量 设置idea M2_HOME dubbox 服务端 http://w ...