How to know ApnsClient is connected to APNS?

191 views
Skip to first unread message

zjhzh...@gmail.com

unread,
Jul 5, 2018, 8:59:06 PM7/5/18
to pushy

final ApnsClient apnsClient = new ApnsClientBuilder()
.setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)
.setClientCredentials(new File("/path/to/certificate.p12"), "p12-file-password")
.build();


Have some callback tell me is already connected to APNS??

Jon Chambers

unread,
Jul 6, 2018, 10:37:17 AM7/6/18
to zjhzh...@gmail.com, pushy
ApnsClient instances create (and reuse) connections on demand. It won't try to open a connection until you try to send a push notification, so there's no need for a callback to tell you that the client is "ready."

Not that you asked, but as a consequence of the connection-on-demand behavior, you'll need to explicitly shut down an ApnsClient when you're done with it (like when your whole application closes, not after you send every notification) via the `ApnsClient#close()` method.

Hope that helps!

-Jon

--
Pushy is an open-source Java library for sending APNs (iOS and OS X) push notifications. Pushy is brought to you by the engineers at RelayRides.
---
You received this message because you are subscribed to the Google Groups "pushy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pushy-apns+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages