我需要在应用程序被杀后点击Activity
(Notification
)打开PendingIntent
。这就是我设置PendingIntent
的方式。
var chatActivityIntent = new Intent (this, typeof(ChatActivity));
chatActivityIntent.PutExtra ("UUID", channelViewModel.uuid);
chatActivityIntent.PutExtra ("CHANNELSVIEWMODEL", JsonConvert.SerializeObject(channelViewModel.channelList [0]) );
chatActivityIntent.AddFlags (ActivityFlags.ClearTop | ActivityFlags.SingleTop | ActivityFlags.NewTask);
var pendingIntent = PendingIntent.GetActivity (this, 0, chatActivityIntent, 0);
notification.SetLatestEventInfo (this, chatviewModel.SchoolName, chatviewModel.Message, pendingIntent);
当应用程序处于活动状态或处于后台时,这可以正常工作。点击通知时会显示ChatActivity
。
但是在App被杀后,当我点击已经到达的通知时,我收到一条错误消息Unfortunately, App has stopped.