使用Firebase Cloud消息自定义布局 [英] Customize layout with Firebase Cloud messaging

查看:73
本文介绍了使用Firebase Cloud消息自定义布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在Android应用中使用Firebase云消息传递功能向用户发送提醒和通知,以使他们与我的应用更加互动.

I am going to use Firebase cloud messaging in my Android App to send reminder and notifications to users to get them more engaged with my app.

因此,我希望对通知进行自定义.我已经阅读过 Cloud Messaging文档,但它仅显示了如何当应用程序在前台时,接收并生成通知.如果应用程序在后台运行,则无法进行相同的操作.如果应用程序在后台运行,则会显示一条正常通知.

For that reason, I want to have a custom look of the notification. I have gone through the Cloud Messaging documentation but it only shows how to receive and build a notification when the app is in the foreground. The same does not work if the app is in the background. If the app is in the background then a normal notification is shown.

我已经浏览了许多帖子,说我可以将通知字段保留为空白,并且可以将数据放在数据字段中,但是对我来说,主要的问题是我没有使用自定义服务器来分派通知,但我使用的是Firebase提供的默认通知编写器.

I have gone through many posts stating that I can leave the notification field blank and can put data on the data field but for me, the main problem is that I am not using my custom server to dispatch notification but I am using the Default Notification composer provided by Firebase.

是否可以使用默认Firebase Notification Composer显示自定义布局,而不管该应用程序是在前台还是在后台?

任何帮助将不胜感激.

推荐答案

否,当应用程序在后台时,无法使用默认FCM"面板显示自定义布局通知.

No, it is not possible to show custom layout notification using Default FCM panel when the app is in the background.

来自文档:

当您的应用程序在后台运行时,Android会将通知消息定向到系统任务栏.默认情况下,用户点击通知会打开应用启动器.

When your app is in the background, Android directs notification messages to the system tray. A user tap on the notification opens the app launcher by default.

这篇关于使用Firebase Cloud消息自定义布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆