Alternative Way On How To Change Setlatesteventinfo In Notification Receiver
Hi i got stock in this point wherein 'setLatesEventInfo' has an error. i know that setLatestEventInfo doesnt run on API 23 and up. can someone help me on how to make this code run
Solution 1:
Now you have to generate your notification like this
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(context);
// set intent so it does not start a new activity
Notification notification = builder
.setContentIntent(yourPendingIntent)
.setSmallIcon(icon)
.setWhen( System.currentTimeMillis();)
.setContentTitle(title)
.setContentText(message).build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(notifId, notification);
Post a Comment for "Alternative Way On How To Change Setlatesteventinfo In Notification Receiver"