Notification的使用
来源:互联网 发布:直播软件收入排行榜 编辑:程序博客网 时间:2024/06/03 20:55
基本通知
创建builder
NotificationCompat.Builder builder = builder = new NotificationCompat.Builder(this);
至少要实现的三个方法
builder.setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Title") .setContentText("Content")
构造并设置PendingIntent
Intent intent = new Intent(getApplicationContext(), NotificationActivity.class);PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);builder.setContentIntent(pendingIntent);
获取NotificationManager并开启通知
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);manager.notify(1, builder.build());
注意:notify的第一个参数为ID值,若有多个通知必须使用不同的ID值
0 0
- 3. Notification的使用
- 3、Notification的使用
- Android-Notification的使用
- Android Notification的使用
- android Notification 的使用
- android Notification 的使用
- Android Notification 的使用
- Android-Notification的使用
- android Notification 的使用
- 使用自定义的 Notification
- Notification的使用详解
- android Notification 的使用
- android Notification 的使用
- android Notification 的使用
- Notification 的使用
- android Notification 的使用
- android Notification的使用
- Notification的使用
- poj 2348 Euclid's Game (博弈局面分析)
- 第二天-HTML5之CSS3特效
- Ajax_数据格式_HTML(01)
- sublime text3 中无法输入中文的问题
- memcache 介绍及原理
- Notification的使用
- 【计算机视觉】计算机视觉领域资料收集
- [汇编]8086指令系统---算术指令(一)
- 【慢速学数据结构】树的遍历
- C++虚函数
- KMP算法详解
- vue 扩展
- Servlet数据压缩发送、默认Servlet配置
- 仿微信底部导航