user268397
user268397

Reputation: 1927

Android - replacement for deprecated Notification class

I was wondering what I could use to replace the deprecated Notification class and the setLatestEventInfo() method. It's not recognizing the setLatestEventInfo() method.

Here is the current code I have:

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);
}

What can I replace this with?

Upvotes: 2

Views: 418

Answers (1)

Related Questions