Closed GoogleCodeExporter closed 8 years ago
How much time do you wait between adding the payload to the queue, and invoking
getPushedNotifications?
Since a push queue runs asynchronously, the results would not be available
immediately after adding a payload to the queue. If you need to examine
results, you should either wait for the queue to do its work asynchronously, or
use a Push.payloads method.
Original comment by sype...@gmail.com
on 8 May 2013 at 8:56
I am not expecting results immediately. Instead I have a thread that runs every
2sec. and does the following
1. a.PushedNotifications sentNotifications = queue.getPushedNotifications()
b.for every PushedNotification in queue.getPushedNotifications()
2. queue.clearPushedNotifications()
My test schedules 10 push notifications (5 with VALID token and 5 with INVALID
token. (64 byte long so I don't get InvalidTokenException))
Here is the code snippet (NOTE that I don't clear the queue for bug
demonstration purposes):
private void runQueueResultListener()
{
final Runnable queueResultListener = new Runnable()
{
@Override
public void run()
{
while(true)
{
System.out.println("----------------------");
int i = 0;
for(PushedNotification pn : queue.getPushedNotifications())
{
System.out.println(i + "." + pn.isTransmissionCompleted() + pn.isSuccessful());
i++;
}
try
{
Thread.sleep(2000);
}
catch(Throwable t)
{
t.printStackTrace();
}
}
}
};
new Thread(queueResultListener).start();
}
Now. At any point I get a list of 10 PushedNotification objects. Every one has
isTransmissionComplete() = true and isSuccessful() - true no matter how long I
run this code
Original comment by dmitry.a...@gmail.com
on 8 May 2013 at 9:43
Original issue reported on code.google.com by
dmitry.a...@gmail.com
on 7 May 2013 at 4:29