Android Notification setLatestEventInfo方法已废弃
2016-05-15 11:58
549 查看
代替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 基本组件(一)
- Android如何解决异常问题
- Android存储(读取)之缓存CachesDir存储
- android开发笔记之多媒体—音频和视频的录制
- Android存储(读取)之内存FilesDir存储
- 快速集成android实现listview的字母A-Z排序,界面侧边字母索引
- Android的Selector与Shape
- RadioButton和CheckBox
- android开发笔记之sh脚本
- android 比较靠谱的图片压缩
- android开发笔记之多媒体—MediaPlayer + SurfaceView播放视频
- 浅谈android中加载高清大图及图片压缩方式(二)
- Android数据存储之SharedPreferences及如何安全存储
- Android Activity的生命周期与异常生命周期的分析
- Android Studio安装过程中出现Failed to install Intel HAXM问题及解决方法
- Android之SharedPreferences存储数据
- android LayoutInflater和inflate()方法的用法
- ScrollView嵌套ListView
- android圆角按钮自定义
- android开发笔记之多媒体—SurfaceView