How to handle multiple push notification of pushpl

2019-07-21 15:52发布

问题:

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