How to configure javapns (push notifications for iOS)?

I looked at the / wiki documentation for javapns. http://code.google.com/p/javapns/

Unfortunately, what should be obvious to me is nothing but the obvious.

How to set up a working push notification server? Like in, there is a .jar file, but I would like to get more information than this. Do I need to run this in Tomcat? Is there a working example?

Thanks.

+7
source share
2 answers

I have used Java APNS in the past. It has a BSD license and is great for working and was fairly easy to use after the certificates were installed. In general, it is not an easy task to configure push notifications, but usually I get useful debug output if something else doesn’t work.

The good thing is that this solution is that you can run it autonomously java -jar MyAPNSPusher and run it with some cron job or include the logic in some .war file. I also found that the library was pretty lightweight, and I think you can also find it in the maven repo.

Example from Readme.markdown

To send a notification, you can do this in two stages:

  • Connection setup

     ApnsService service = APNS.newService() .withCert("/path/to/certificate.p12", "MyCertPassword") .withSandboxDestination() .build(); 
  • Create and send a message

     String payload = APNS.newPayload().alertBody("Can't be simpler than this!").build(); String token = "fedfbcfb...."; service.push(token, payload); 

[...]

Alternatives

If hosting your own server solution is too cumbersome, you can refuse the thirdparty service, which can often be good, because hosting a server with such a service running on it is probably often underestimated. Using these services, you usually pay a small amount (fractions of a percent) for a push message. The two I came across are

+10
source

JavaPNS is the Java library used in your project. It can only be used to connect to Apple Push notification servers using certificates created on the Apple Developer Tools website.

So, if I read your question correctly, this is not a standalone program, and probably not what you want.

If you are trying to send push notifications to Apple iOS devices, then this is what you want, but first you need to record the rest of your application, and then add this library to it.

+4
source

All Articles