Android - 替换已弃用的Notification类

时间:2016-06-17 21:21:24

标签: android android-notifications

我想知道我可以用什么来替换deprecated Notification classsetLatestEventInfo()方法。它没有识别setLatestEventInfo()方法。

这是我目前的代码:

public void makeForeground() {
  Notification notification = new Notification(R.drawable.icon, getText(R.string.servicename), System.currentTimeMillis());
  notification.setLatestEventInfo(this, getText(R.string.servicename), this.lang[134], PendingIntent.getActivity(this, 0, new Intent(this, UIActivity.class), 0));
  startForeground(2, notification);
}

我可以用什么替换它?