本文介绍了如何处理pushplugin的多个推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的Cordova应用程序中使用pushplugin安卓系统.单个消息没有问题.在最小化应用程序的情况下发送多条消息时,我只能看到最后一条通知取代了之前的通知.

我关注了 https://github.com/manjeshpv/PushPlugin/commit/cdd1f33ef7a61965一个> https://github.com/manjeshpv/PushPlugin/commit/d073ed105aafbb1f8793> >

这些都不适合我.我也在有效负载中使用notId.在我的php文件中:

$message = '{"conversation":"'.$message.'", "phoneNumber":"'.$phoneNumber.'", "file":"text", "notId":"'.time().'"}';

几乎没有类似的问题,但是问题并没有在那里解决.如何在android中处理多个推送通知

解决方案

解决了自己

$message = '{"conversation":"'.$message.'", phoneNumber":"'.$phoneNumber.'"}';

在php curl中:

$field = array( 'registration_ids' => array($registatoin_id), 'data' => array( 'message' => $message, 'title'=>'kwikieText', 'msgcnt'=>'3', 'notId'=>''.time() ), );

notId必须添加到数据"字段,而不是$ message变量

I'm using pushplugin in my cordova app for android. There is no problem for single message. While sending multiple message when app is minimized, I see only the last notification which replaces the previous notifications.

I followed https://github.com/manjeshpv/PushPlugin/commit/cdd1f56ef7a6a2033a196546cd6b946dc17044aehttps://github.com/manjeshpv/PushPlugin/commit/d073ed105aafb1f8793ea3c9a2b5b04e8293f507

None of these working for me.I'm also using notId in payload. In my php file:

$message = '{"conversation":"'.$message.'", "phoneNumber":"'.$phoneNumber.'", "file":"text", "notId":"'.time().'"}';

There would have few similar questions but the problem was not solved there.how to handle multiple push notifications in android

解决方案

Solved myself

$message = '{"conversation":"'.$message.'", phoneNumber":"'.$phoneNumber.'"}';

In php curl:

$field = array( 'registration_ids' => array($registatoin_id), 'data' => array( 'message' => $message, 'title'=>'kwikieText', 'msgcnt'=>'3', 'notId'=>''.time() ), );

notId must be added to 'data' field not the $message variable

这篇关于如何处理pushplugin的多个推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 09:03