Meaningless Drivel is fun!*
The moose likes iOS and the fly likes Push Notification to APNS  - error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Push Notification to APNS  - error" Watch "Push Notification to APNS  - error" New topic
Author

Push Notification to APNS - error

Gokul Kesavalu
Greenhorn

Joined: Jan 08, 2008
Posts: 20
hi i have written a java class to send push notification to APNS.
But i am getting Caused by: java.net.ConnectException: Connection refused: connect exception. Please help me ti fix this. I have given the certificates, password correctly.

ApnsService service = APNS.newService().withCert("D:/iOS/Certificates.p12", "Karthik123")
.withSandboxDestination().build();
System.out.println("Service Created : "+service);
service.start();
System.out.println("Service started");

service.testConnection();
System.out.println("Connection success");
String payload = APNS.newPayload().alertBody(
"This is a sample Notification Message!").build();

System.out.println("Payload Created : "+payload);
String token = "b7ae2ef781d2b4406c9ebf6011ac733c95b59867";
service.push(token, payload);
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Are you using something like https://github.com/notnoop/java-apns ?
Gokul Kesavalu
Greenhorn

Joined: Jan 08, 2008
Posts: 20
Hi,


Thanks for your reply. I am using JavaPNS. i have created payload and sent. Also i am getting successful transmission to apple push notification server. But it is not received in the iPhone. What will be the issue.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Push Notification to APNS - error
 
Similar Threads
Push on web and mobile
Problem sending Apple Push Notification using Java and REST
unexpected element type error
Split using regex doubt
add soap header method