Giter Club home page Giter Club logo

Comments (13)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
instead of looping thru each iphone id and naming the device 'iPhone'...

loop thru each iphone id and add it to the pushmanager as a unique device.

Then send all the notifications in one shot.

like:

for device in database
           pushManager.addDevice("iPhone", device.getDeviceToken());
           client=pushManager.getDevice( device.name ); 
end for

pushManager.sendNotification(client, payLoad);

for device in database
           pushManager.removeDevice(device.name);
end for

Original comment by [email protected] on 9 Dec 2010 at 5:41

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Hi, 
Thanks for your reply. By looking at the above code skeleton, wouldn't client 
represent the last device in the for loop. Please advise.

Original comment by [email protected] on 9 Dec 2010 at 6:50

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
I'm assuming device is a row coming back from your database call.

And device.name is unique to that device 
and device.token is the unique token for said device row.

Original comment by [email protected] on 9 Dec 2010 at 7:03

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Yes, what you have assumed is correct. I think you did not understand my 
question...

In the below line
pushManager.sendNotification(client, payLoad);

doesn't client represent the last device present in the DB  and so won't the 
notification be sent to only that device.

Please let me know...

Original comment by [email protected] on 9 Dec 2010 at 7:10

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
I'm very busy at the moment, so please read the wiki, there are examples 
already provided.

The important part, is to only initialize the connection once, send all the 
notifications, then close the connection.

Bill

Original comment by [email protected] on 9 Dec 2010 at 7:30

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Okay..Thanks. I did change the code as per your code skeleton and as expected 
only the last device returned from the DB got notified. 

I think it is because you have put
 pushManager.sendNotification(client, payLoad);

outside the for loop. I couldn't locate any example on the wiki for sending 
bulk pushes. Please re-examine you suggested code and reply back when you get 
time

Thanks
John

Original comment by [email protected] on 9 Dec 2010 at 8:19

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
I did not understand the line made in Comment #1
"Then send all the notifications in one shot."

Since you are calling 
pushManager.sendNotification(client, payLoad);

outside the loop. So won't only the device represented in 'client' be notified. 
Please advice

Original comment by [email protected] on 10 Dec 2010 at 2:11

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
See:
http://code.google.com/p/javapns/wiki/MultipleClientsExample

I have not tested the code, but it should have everything in the right place.

Someone is working on a database connection piece that may streamline this 
process, but I do not know the status at this time.

Original comment by [email protected] on 11 Dec 2010 at 7:08

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024

Original comment by [email protected] on 11 Dec 2010 at 7:08

  • Added labels: Type-Other
  • Removed labels: Type-Defect

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Thanks. I have implemented your template into my code.

Original comment by [email protected] on 13 Dec 2010 at 3:29

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Comment by MrPatol, Dec 15 (2 days ago)
missing line before

pushManager.sendNotification( client, aPayload );
should have:

Device client = pushManager.getDevice(user.getUsername());

Original comment by [email protected] on 17 Dec 2010 at 6:00

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
example has been updated

Original comment by [email protected] on 17 Dec 2010 at 6:01

from javapns.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Closing issue since example for javapns 1.x has been updated, and because 
javapns 2.0 provides direct support for this.

Original comment by [email protected] on 7 Sep 2011 at 1:13

  • Changed state: Fixed

from javapns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.