在应用程序被杀死后,通过PendingIntent通知打开活动,导致应用程序崩溃

时间:2015-06-04 11:25:19

标签: android xamarin xamarin.android android-service

我需要在应用程序被杀后点击ActivityNotification)打开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.

0 个答案:

没有答案