Tôi đang làm việc trên Thông báo và tôi phải sử dụng setLatestEventInfo
. Tuy nhiên, Android Studio hiển thị thông báo lỗi sau:Không thể giải quyết Phương thức setLatestEventInfo
không thể giải quyết phương pháp setLatestEventinfo
Dưới đây là đoạn mã của tôi:
private void createNotification(Context context, String registrationID) {
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon,"Registration Successfull",System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(context,RegistrationResultActivity.class);
intent.putExtra("registration_ID",registrationID);
PendingIntent pendingIntent = PendingIntent.getActivity(context,0,intent,0);
notification.setLatestEventInfo(context,"Registration","Successfully Registered",pendingIntent);
}
Hoặc nếu họ là một cách khác để làm như vậy, vui lòng đề nghị tôi điều đó.
'setLatestEventInfo' là 'phản đối' làm nó sử dụng' NotificationCompat.Builder' –