使用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.