Android Notification setLatestEventInfo方法已废弃
代替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);