| .setContentText() | 内容 |
| .setDefaults(Notification.DEFAULT_ALL); | 提醒方式(ALL代表 声音 振动 提示灯兼备) |
| .setLargeIcon() | 大图标 |
| .setContentIntent() | 点击跳转 |
| .setWhen() | 通知时间(何时通知) |
| .setAutoCancel(boolean) | 点击后是否关闭通知 |
| .setPriority(Notification.PRIORITY_MAX) | 通知的优先级(MAX表示最高级) |
API15以及以下的使用需要注意
1 .java代码中最后那条 .build()方法需要换成.getNotification()
如下: notificationManager.notify(0, builder.getNotification());
2. .setPriority() 方法不可用
接下来是完整的实现
java文件中
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification.B