目前 Android 已经不推荐使用下列方式创建 Notification实例:
Notification notification = new Notification(R.drawable.ic_launcher,"This is ticker text",System.currentTimeMillis());
最好采用下列方式:
Notification notification = new Notification.Builder(this)
.setContentTitle("This is title")
.setContentText("This is content")
.setSmallIcon(R.drawable.ic_launcher)
.setTicker("This is ticker")
.setContentIntent(pi)
.build();