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 ...
随机推荐
- uva 1203 - Argus
简单的优先队列的应用: 代码: #include<queue> #include<cstdio> using namespace std; struct node { int ...
- Delphi直接让QT进入指定房间
WinExec('./QT/QT.exe qt://join/?roomid=3955&subroomid=287307288&ext=gid:536023504;et:1001', ...
- Android日志框架darks-logs使用教程
一.配置文件 在使用darks-logs之前,我们需要为它创建一个名叫logd.properties的配置文件.如果你是需要在JAVA或WEB上使用该组件,那么你可以像配置log4j一样将它放在cla ...
- [BZOJ2173]整数的lqp拆分
[题目描述] lqp在为出题而烦恼,他完全没有头绪,好烦啊… 他首先想到了整数拆分.整数拆分是个很有趣的问题.给你一个正整数N,对于N的一个整数拆分就是满足任意m>0,a1 ,a2 ,a3…am ...
- Node.js权威指南 (3) - Node.js基础知识
3.1 Node.js中的控制台 / 19 3.1.1 console.log方法 / 19 3.1.2 console.error方法 / 20 3.1.3 console.dir方法 / 21 3 ...
- Defining as a "long" or "int" type throws an error on startup
solr启动时候,报如下异常: [java] view plaincopy SEVERE: org.apache.solr.common.SolrException at org.a ...
- 【传】玩转Android---UI篇---ImageButton(带图标的按钮)
原文网址:http://hualang.iteye.com/blog/964049 除了Android系统自带的Button按钮一万,还提供了带图标的按钮ImageButton 要制作带图标的按钮,首 ...
- Google Map API 学习三
- (转载)mysql group by 用法解析(详细)
(转载)http://blog.tianya.cn/blogger/post_read.asp?BlogID=4221189&PostID=47881614 mysql distinct 去重 ...
- delphi调用webservice 转
如今 Web Service 已越来越火了,在DotNet已开发的Web Service中,Delphi 7如何方便的调用DotNet写的Web Service呢?方法有两种,一种是在Delphi ...