Notification用法
String message = "You should click come back now. It is time out more than 10 minutes.";
// MessageDialog.showMessageDialog(MainActivity.act, message); Intent intent = new Intent(MainActivity.this, MainActivity.class);
// intent.setAction(Intent.ACTION_MAIN);
// intent.addCategory(Intent.CATEGORY_LAUNCHER);
// intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0 /* Request code */, intent,
PendingIntent.FLAG_CANCEL_CURRENT); //PendingIntent.FLAG_UPDATE_CURRENT // Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(MainActivity.this)
.setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(R.drawable.ba)
.setContentTitle(getString(R.string.app_name))
.setContentText(message)
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_MAX)
// .setSound(defaultSoundUri)
.setContentIntent(pendingIntent); NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); long time = new Date().getTime();
String tmpStr = String.valueOf(time);
String last4Str = tmpStr.substring(tmpStr.length() - 5);
int mId = Integer.valueOf(last4Str);
notificationManager.notify(mId /* ID of notification */, notificationBuilder.build());
Notification用法的更多相关文章
- PhoneGap中navigator.notification.confirm的用法详解
navigator.notification.confirm('您确定要退出程序吗?', showConfirm, '退出程序', '确定,取消'); function showConfirm(but ...
- Android之Notification的多种用法(转)
我们在用手机的时候,如果来了短信,而我们没有点击查看的话,是不是在手机的最上边的状态栏里有一个短信的小图标提示啊?你是不是也想实现这种功能呢?今天的Notification就是解决这个问题的. 我们也 ...
- Android之Notification的多种用法
我们在用手机的时候,如果来了短信,而我们没有点击查看的话,是不是在手机的最上边的状态栏里有一个短信的小图标提示啊?你是不是也想实现这种功能呢?今天的Notification就是解决这个问题的. 我们也 ...
- Notification (通知)的 新版和旧版用法
Notification (通知)的 新版和旧版用法 一.先来看旧版,Api 11 之前的用法: NotificationManager manager = (NotificationManage ...
- Android API Level在11前后及16之后时Notification的不同用法
作为刚入门Android的小白,最近在按照郭大神的<第一行代码>在练习,在用到Notification时遇到了一些问题,网上资料比较零散,我这里做了一个总结分析给各位,若有错误,恳请指正~ ...
- Android学习总结(十五) ———— Notification(状态栏通知)基本用法
一.Notification基本概念 Notification是一种具有全局效果的通知,它展示在屏幕的顶端,首先会表现为一个图标的形式,当用户向下滑动的时候,展示出通知具体的内容.我们在用手机的时候 ...
- Android Notification.setLatestEventInfo弃用和Notification.Builder用法
今天在学习小米便签的源码的时候,至于源码的地址,http://m.blog.csdn.net/article/details?id=50544248 ,里面有好多github的开源项目,打开项目,报错 ...
- 3、android notification 详细用法
在 android 系统中,在应用程序可能会遇到几种情况需要通知用户,有的需要用户回应,有的则不需要,例如: * 当保存文件等事件完成,应该会出现一个小的消息,以确认保存成功. * 如果应用程序在后台 ...
- 2.6.2 Notification的功能与用法
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout ...
随机推荐
- IE6的position:fixed
手头一个项目中,要实现把一个浮层控制在浏览器窗口右下角,用”position:fixed”来控制最合适不过了. 但万恶的IE6不支持这个属性,之前采用过的方法有:将滚动条转移到body上,使用绝对定位 ...
- ASP.NET 跨域获取JSON天气数据
前几天做一个门户网站,在首页需要加载气象数据,采用了中央气象局的接口. 刚开始采用JSONP在前台跨域请求数据,没成功~ 后换成在c#后台请求数据返回... 前端代码: $(function () { ...
- Swiper API
本文分享自 http://www.cnblogs.com/scavengers/p/3760449.html 最近使用Swipe.js,发现中文的资料很少,试着翻译了一下.能力有限,翻译难免错漏,欢迎 ...
- 服务器无法播放flv格式的视频解决办法
浏览某个网站时播放视频可能会出现下面的情况: 其实原因很简单,因为国内大多都是Win2003的主机 .默认是没有指定输出FLV这种格式的. 虽然FTP里面可以看见,但无法通过http访问,也就无法播放 ...
- UI5_UINavigation传值
// // AppDelegate.m // UI5_UINavigation传值 // // Created by zhangxueming on 15/7/7. // Copyright (c) ...
- Webservice发布出现 测试窗体只能用于来自本地计算机的请求
今天发布了一个接口,一开始以为是.netframework版本的问题,从3.5降到2.0到服务器发布,发布后还是会出现 测试窗体只能用于来自本地计算机的请求 上网查找资料发现原来是 webconfig ...
- GDAL中RasterIO函数(把文件读取为一个一维数组)和ReadBlock函数(读取栅格数据块)
CPLErr GDALRasterBand::RasterIO ( GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, ...
- 试写Python内建函数range()
还没查阅源码,先试着练手 class my_range(object): def __init__(self, *args): if not args: raise TypeError, 'range ...
- 《DNS服务缓存的建立》RHEL6
安装dns软件包: 启动dns服务器 配置本地服务器dns域名解析: 查看dns的服务的端口是否打开: 解析百度测试: 安装dns缓存包: 再次访问解析百度
- 经典SQL语句大全 学者必看
一.基础 .说明:创建数据库 CREATE DATABASE database-name .说明:删除数据库 drop database dbname .说明:备份sql server --- 创建 ...