notification.setLatestEventInfo(context, title, message, pendingIntent); undefined
notification.setLatestEventInfo(context, title, message, pendingIntent); 在target为23时删除了该方法,我们应该使用build模式
低于API Level 11版本,也就是Android 2.3.3以下的系统中,setLatestEventInfo()函数是唯一的实现方法。
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
notification.setLatestEventInfo(context, title, message, pendingIntent);
manager.notify(id, notification);
高于API Level 11,低于API Level 16 (Android 4.1.2)版本的系统中,可使用Notification.Builder来构造函数。但要使用getNotification()来使notification实现。前面版本在notification中设置的Flags,icon等属性都已经无效,要在builder里面设置。
.setAutoCancel(true)
.setContentTitle("title")
.setContentText("describe")
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setWhen(System.currentTimeMillis())
.setOngoing(true);
notification=builder.getNotification();
高于API Level 16的版本,就可以用Builder和build()函数来配套的方便使用notification了。
.setAutoCancel(true)
.setContentTitle("title")
.setContentText("describe")
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setWhen(System.currentTimeMillis())
.build();
notification.setLatestEventInfo(context, title, message, pendingIntent); undefined的更多相关文章
- Android Notification.setLatestEventInfo弃用和Notification.Builder用法
今天在学习小米便签的源码的时候,至于源码的地址,http://m.blog.csdn.net/article/details?id=50544248 ,里面有好多github的开源项目,打开项目,报错 ...
- Android Notification setLatestEventInfo方法已废弃
代替setLatestEventInfo的方法是用Notification.Builder创建Builder对象,通过该对象设置Notification相关属性. otification.Builde ...
- reportComplaints.js: Uncaught TypeError: Cannot read property 'message' of undefined
vonic 中遇到这么个问题, 一直提示我未定义, 可是明明有定义 var tab={ message:{ number:'', title:'' } } var id= { template: '# ...
- Androidn Notification的使用,解决找不到setLatestEventInfo方法
转自:http://blog.csdn.net/songyachao/article/details/51245370#comments 今天使用4.0.3使用 Notification notifi ...
- 【转】【Android】Android不同版本下Notification创建方法
使用 new Notification(int icon, CharSequence tickerText, long when)构造函数时,Eclipse却提示:" The constru ...
- Android不同版本下Notification创建方法
项目环境 Project Build Target:Android 6.0 问题: 使用 new Notification(int icon, CharSequence tickerText, lon ...
- Android下setLatestEventInfo警告、Handler警告、SimpleDateFormat警告
正 文: 今天飘易在做Android 4.4.2下的APP开发时,使用了Notification下的setLatestEventInfo()方法时,Eclipse却提示:“ 不建议使用类型 Notif ...
- Android Notification如何显示表情?
遇到这种分析用什么实现的,肯定要祭出大杀器Android Device Monitor(AS在Tools->Android)打开之后,选中连接的设备,然后点击小手机图标,即可导出UI层次图.咱们 ...
- [置顶] android之Notification版本兼容性问题
首先先来创建一个notification提示 //概要 String tickerText = context.getResources().getText(R.string.app_name).to ...
随机推荐
- the design of everyday things
Design principles: Conceptual models Feedback Constraints Affordances All are important. This is wha ...
- Water Tree
Codeforces Round #200 (Div. 1) D:http://codeforces.com/problemset/problem/343/D 题意:给你一颗有根树,树的每个节点有一个 ...
- 深入了解一下PYTHON中关于SOCKETSERVER的模块-B
请求多个文件的原型. 这个是最草的情况,就是硬编码到内存中的字符串, 真实的应用还是会转到其它端口处理,或是读到硬盘上的文件吧. #!/usr/bin/env python from BaseHTTP ...
- Myeclipse中可以正常显示,但运行后的网页找不到图片
目录为: 1 douban 1.1 css 1.2 image 2 pages 2.1 index.jsp 路径为:<img src="../douya/image/lg ...
- WIN10 + VS2015 + WDK10 + SDK10 + VM虚拟机驱动开发调试环境搭建
http://blog.csdn.net/qing666888/article/details/50858272#comments
- hadoop-2.0.0-cdh4.2.1源码编译总结
经过一个星期多的努力,这两个包的编译工作总算告一段落. 首先看一下这一篇文章: 在eclipse下编译hadoop2.0源码 http://www.cnblogs.com/meibenjin/arch ...
- 【转】 log4cpp 的使用
[转自] http://sogo6.iteye.com/blog/1154315 Log4cpp配置文件格式说明 log4cpp有3个主要的组件:categories(类别).append ...
- UVA 11427 Expect the Expected(DP+概率)
链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35396 [思路] DP+概率 见白书. [代码] #include&l ...
- c语言 快速排序---归并排序----堆排序
//快速排序: #include <stdio.h> #define MAX 500000 int s[MAX]; void Q_Sort(int start,int end) { int ...
- Nginx + Tomcat 动静分离实现负载均衡
0.前期准备 使用Debian环境.安装Nginx(默认安装),一个web项目,安装tomcat(默认安装)等. 1.一份Nginx.conf配置文件 # 定义Nginx运行的用户 和 用户组 如果对 ...