简体   繁体   English

当应用程序在后台时,Cordova推送通知不起作用

[英]Cordova push notification not working when app is in background

I have implemented push notification in Cordova application by using following plugin 我已经通过使用以下插件在Cordova应用程序中实现了推送通知

It's receiving notifications in application(but Not in notification area). 它正在应用程序中接收通知(但不在通知区域中)。 But when my app is in background it does not show any notification. 但是,当我的应用程序在后台运行时,它不会显示任何通知。

So it's working only when app in foreground. 因此,仅当应用程序在前台时才起作用。

So, I have 2 questions : 所以,我有两个问题:

  1. How to show received notification in notification area? 如何在通知区域显示收到的通知?

  2. How to received notification even my app is in background? 即使我的应用程序在后台,如何接收通知?

I got my answer. 我得到了答案。

First go through GCM documentation, then I realize that I was not sending 'message' in 'data' parameter of push notification. 首先查看GCM文档,然后我意识到我没有在推送通知的“数据”参数中发送“消息”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM