Android 表单推送通知
我正在向Xamarin.Forms应用程序实现推送通知。我包括了这个插件-。它工作得很好,我唯一缺少的就是在应用程序关闭(关闭)时收到推送通知 开始使用插件作者提供的示例(),只需要添加Xamarin.GooglePlayServices.Base numget包,其余的几乎没有涉及。我在Firebase控制台中设置了该项目,现在我可以从Postman发送通知,这看起来不错: 当应用程序位于前台时Android 表单推送通知,android,firebase,xamarin,xamarin.forms,push-notification,Android,Firebase,Xamarin,Xamarin.forms,Push Notification,我正在向Xamarin.Forms应用程序实现推送通知。我包括了这个插件-。它工作得很好,我唯一缺少的就是在应用程序关闭(关闭)时收到推送通知 开始使用插件作者提供的示例(),只需要添加Xamarin.GooglePlayServices.Base numget包,其余的几乎没有涉及。我在Firebase控制台中设置了该项目,现在我可以从Postman发送通知,这看起来不错: 当应用程序位于前台时 CrossFirebasePushNotification.Current.OnNotificat
CrossFirebasePushNotification.Current.OnNotificationReceived
事件已正确触发
当应用程序后台运行时,会显示通知,播放叮当声,当我单击它时
CrossFirebasePushNotification.Current.OnNotificationOpened
事件被触发
到目前为止还不错
但是,当应用程序被终止时,如何显示通知?我想应该在通知到达时由操作系统完成?但很明显我错了,或者我错过了什么。如果我从邮递员处发送通知,并且应用程序关闭,则不会发生任何事情,不会显示任何通知,也不会触发任何事件
MainApplication.cs类中还有以下事件处理程序,看起来很有前途,但也只有在应用程序处于后台时才会触发
//Handle notification when app is closed here
CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
{
System.Diagnostics.Debug.WriteLine("NOTIFICATION RECEIVED", p.Data);
};
有没有办法让这一切顺利进行
谢谢
Jiri你在发送通知消息还是数据消息?我在发送数据消息,比如{“to”:“,“data”:{“msg”:“Hello”,“title”:“Hello”,“body”:“Some content”,“extradata”:{“dummy1”:“111”}}}}@JiriMatejka你明白了吗?