码迷,mamicode.com
首页 > 移动开发 > 详细

Android Notification setLatestEventInfo方法已废弃

时间:2016-05-15 12:27:05      阅读:717      评论:0      收藏:0      [点我收藏+]

标签:

代替setLatestEventInfo的方法是用Notification.Builder创建Builder对象,通过该对象设置Notification相关属性。

otification.Builder builder = new Notification.Builder(this);
builder.setContentText("Text");
builder.setContentTitle("Title");
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setSubText("secondText");
builder.setWhen(System.currentTimeMillis() + 300);
builder.setTicker("Ticker");
builder.setContentIntent(pi);
builder.setAutoCancel(true);
long[] vb = {0, 100, 1000, 100};
notification=builder.build();
notification.vibrate=vb;
notification.ledARGB = Color.GREEN;
notification.ledOnMS=1000;
notification.ledOffMS=1000;
manager.notify(1, notification);

Android Notification setLatestEventInfo方法已废弃

标签:

原文地址:http://www.cnblogs.com/zhengshiqiang47/p/5494966.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!