0
사용자 정의 알림을 보내고 있으며 수신자는 인 텐트를 위해 알림의 레이아웃에서 요소의 텍스트를 변경합니다. 알림을 업데이트 할 때 아무 일도 일어나지 않습니다. 의도가 수신자에게 전달되고 있습니다. 로그에 체크인했습니다. 통지를하는 활동과 수신자는 별도의 클래스입니다. 어떤 아이디어? 위젯에 대한 AppWidgetProvider는 훌륭하게 작동합니다. 그러나이 경우에는 AppWidgetProvider가 없습니다. 이것은 일반적인 알림입니다. RemoteView를 무효로하는 다른 방법이 있습니까?RemoteView를 무효화하는 방법
//Receiver.onReceive() method
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.notification_layout);
//make dataString
views.setTextViewText(R.id.n_track_name, dataString);
//while searching i figured out this is something that should update notification
NotificationManager mNotificationManager = (NotificationManager)act.getSystemService(Activity.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, act.notification);
이 다른 활동에서 처음으로 알림을 만드는 코드는 다음과 같습니다
act.notification.contentView = views;
이 코드는되어야한다 : 사람이 같은 문제가있는 경우
Notification notification = new Notification(icon, "Music Player", when);
NotificationManager mNotificationManager = (NotificationManager)MusicPlayerActivity.currentActivity.getSystemService(NOTIFICATION_SERVICE);
RemoteViews contentView = new RemoteViews(act.getPackageName(), R.layout.notification_layout);
//make pending intent on button
Intent intent = new Intent(act, NotificationReceiver.class);
intent.setAction(NotificationReceiver.ACTION_NOTIFICATION_NEXT);
PendingIntent actionPendingIntent = PendingIntent.getBroadcast(act, 0, intent, 0);
contentView.setOnClickPendingIntent(R.id.n_btnNext, actionPendingIntent);
//make other intents
//show notification
mNotificationManager.notify(1, notification);