Expo keep adding push notifications and send everything

#1

Hi,

I follow this tutorial https://docs.expo.io/versions/latest/guides/push-notifications

I was able to send notification, but every time I send, it also send the previous.

So first time ok.
Then second time, I receive two notifications, …

#2

#3

any help on how to avoid send the same notification?

#4

Hey @expo2019,

Can you share the code that you implemented that handles the notification delivery? Also, can you try using the testing tool here and see if it sends multiple? https://expo.io/dashboard/notifications

Cheers,

Adam

#5

I tested and it adds the messages when I use the same string.

If I replace otherInterest with something else, then it sends just one notification.

<?php

require_once __DIR__.'/vendor/autoload.php';

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
  
$interestDetails = ['otherInterest', 'ExponentPushToken[...]'];

// You can quickly bootup an expo instance
$expo = \ExponentPhpSDK\Expo::normalSetup();

// echo 'subscribing';
// Subscribe the recipient to the server
$expo->subscribe($interestDetails[0], $interestDetails[1]);


// $notification = ['body' => 'Hello World!'];
$notification = ['body' => 'Hello Expo!', 'data'=> json_encode(array('someData' => 'goes here'))];

// Notify an interest with a notification
$expo->notify($interestDetails[0], $notification);

// echo 'Notification sent.';

?>
#7

Ah. The PHP server is not maintained by the Expo team, but rather by fellow exponauts in the community. I would raise an issue here if you can create a reproducible example. Did you try the testing tool to see if the same thing occurs?

1 Like
#8

Thank you Adam. It is probably me that is misusing the library. I will try the testing tool.

closed #9

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.