How to handle multiple push notification of pushplugin

戏子无情 提交于 2019-12-24 05:31:11

问题


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/cdd1f56ef7a6a2033a196546cd6b946dc17044ae https://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


回答1:


The answer in your linked question is wrong. The correct field to add is notId (not notificationID) This will separate your notifications.




回答2:


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



来源:https://stackoverflow.com/questions/27533796/how-to-handle-multiple-push-notification-of-pushplugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!