代替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);

相关文章:

  • 2021-10-14
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-09-05
  • 2021-11-22
猜你喜欢
  • 2022-01-07
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
相关资源
相似解决方案