最近一直在研究 android ,并一边研究一边做应用。其中遇到了把程序通知常驻在 Notification 栏,并且不能被 clear 掉(就像android QQ一样)的问题。经过研究实现了其功能,现把 Notification 的使用总结如下:
Notification 的使用需要导入 3 个类
1
2
3
|
import android.app.PendingIntent; import android.app.NotificationManager; import android.app.Notification; |
代码示例及说明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|