c# - 应用关闭或休眠时获取通知参数 Firebase
问题描述
当应用程序打开时,我按如下方式处理传入通知。我将操作写入参数,即单击通知后需要打开的页面的名称。
protected override void OnNewIntent(Intent intent)
{
base.OnNewIntent(intent);
ProcessingMessage(intent);
}
private void ProcessingMessage(Intent intent)
{
if(null != intent)
{
if(null != intent.Action)
{
INotificationHandler notificationHandler = DependencyService.Get<INotificationHandler>();
switch (intent.Action)
{
case "Re-registration": //Перерегистрация
notificationHandler.CallReRegistrPage();
break;
}
}
}
}
在此之前,我使用方法`OnMessageReceived(RemoteMessage message) 添加了所需的数据。当应用程序关闭时,这种方法自然是行不通的。当应用程序处于休眠或关闭状态时,有哪些方法可以了解发送的通知类型以及如何进一步使用它?
如何在应用程序关闭时传递参数并在单击通知后阅读它们以了解为它打开哪个页面?
这是我的后台
private Message CreateNotification(string title, string notificationBody, string token, Dictionary<string, string> Data, bool isPriority)
{
var message = new Message()
{
Data = Data,
Token = token,
Notification = new Notification()
{
Body = notificationBody,
Title = title
}
};
if (isPriority)
{
message.Android = new AndroidConfig
{
TimeToLive = TimeSpan.FromHours(1),
Priority = Priority.High
};
}
return message;
}
也许在这里您可以添加一些我可以在启动应用程序时单击通知后读取的参数?
请给我一些面包屑。
解决方案
推荐阅读
- c++builder-6 - C++ Builder DrawGrid 用法
- javascript - 为什么我的按钮不再调用该函数?
- java - NetBeans 永远“运行...”并且不会编译
- html - 主页的图片链接不可点击
- sql - 如何订购商品和子商品?
- php - PHP Array 将数字键重新排列为父键
- apollo-server - Apollo Server:dataSources vs context 与数据库一起使用
- c# - 我无法使用 C# 将数据保存到我的 SQL 数据库
- javascript - 可以预加载使用 canLoad 的模块吗?
- json - 空手道——JSON响应解析