Closed GoogleCodeExporter closed 8 years ago
Your code always adds devices with the same ID ("iPhone" in your case). Thus
if you call your Push method twice, you will indeed get a duplicate device
exception (ie "Client already exists").
SOLUTION FOR JAVAPNS 1.x: You should make sure that devices are added with
unique IDs. Using the device token as the ID is a good way of ensuring unique
IDs: pushManager.addDevice(iPhoneId, iPhoneId); and then later: Device
client = pushManager.getDevice(iPhoneId);
SOLUTION FOR JAVAPNS 2.0: In 2.0, there is no need to add and get devices when
no persistence backend is required. The simple "javapns.Push" class allows you
to push notifications with a single line of code (see wiki).
Original comment by sype...@gmail.com
on 6 Sep 2011 at 4:29
Actual Code
Original issue reported on code.google.com by
franklin...@gmail.com
on 4 Sep 2011 at 1:01