Closed GoogleCodeExporter closed 8 years ago
All these steps were successful:
1.Create a Proxy and verify the key store - Success
2.Create AppleNotificationServer instance and PushNotificationManager instance
- Success
3.Initialize the Manager and Push notifications - Success
Original comment by hirant...@gmail.com
on 26 Apr 2012 at 8:57
The way you create your payload results in an empty standard "aps"
dictionary... What happens if you add an alert to your payload, while leaving
the rest of your code intact?
Original comment by sype...@gmail.com
on 26 Apr 2012 at 9:53
So, can you please help me to create the payload?
Original comment by hirant...@gmail.com
on 26 Apr 2012 at 10:23
I do not know what your iOS application's particular needs are, so it's
difficult to help beyond what is already in the documentation. There are
several examples in the Basic Push Notification and Advanced Push Notification
wiki pages on this site which should help you get on the right track. Your
code is overly complex and I'm not sure how you ended up with that, but the
library is designed to be much, much simpler to use, as you will see in the
documentation. Thank you.
Original comment by sype...@gmail.com
on 27 Apr 2012 at 1:37
Even this resulted the same:
public void sendNotification(String token)
throws Exception {
try {
ProxyManager.setProxy("proxy.net", "8443");
List<PushedNotification> notifications = new ArrayList<PushedNotification>();
notifications =Push.test(new File("CIGMobiSuite.p12"), "cigmobisuite", false, token);
printPushedNotifications(notifications);
}
catch (Exception e) {
e.printStackTrace();
}
}
According to the logs the message was successfully pushed. But device didn't
receive any messages.
Log Message:
All notifications pushed successfully (1):
[1] transmitted {"aps":{"alert":"JAVAPNS DEBUG ALERT 1\n2012/04/27 09:20:49\ngateway.sandbox.push.apple.com\nCDD6\u20261C6F [Id:1] Exp:T+86400\nEnhanced format / UTF-8"}} on first attempt to token cdd6a..c1c6f
Can you kindly let me know a cause for this?
Original comment by hirant...@gmail.com
on 27 Apr 2012 at 1:24
Please note that I need to send the messages via a proxy as I am behind a
firewall and I think this is the correct way to do it. When I commented the
ProxyManager.setProxy("proxy.net", "8443") statement my code throws a
connection time out exception. So, After I add this statement I didn't get any
errors and I think this is the way that this tool is designed to work with a
proxy.
Original comment by hirant...@gmail.com
on 27 Apr 2012 at 1:36
Have you tested your code outside of a proxy, just to rule out that the proxy
might be the issue?
Are you positively sure that your app is configured to receive notifications,
that you are using the right APNS server for your certificate, that your app is
built with the same certificate, that your device's date and time are correctly
set, etc.? (just covering the basics...)
Original comment by sype...@gmail.com
on 27 Apr 2012 at 2:19
This code worked fine for me and now I can successfully send messages without
any issues. Thanks a lot for your quick response and for the directions
provided.
public void sendNotification(String token)
throws Exception {
try {
PushNotificationPayload payLoad = new PushNotificationPayload();
payLoad.addCustomAlertBody("Build Successfull 0715");
ProxyManager.setProxy("proxy.net", "8443");
List<PushedNotification> notifications = new ArrayList<PushedNotification>();
notifications =Push.payload(payLoad, new File("CIGMobiSuite.p12"), "cigmobisuite", false, token);
printPushedNotifications(notifications);
}
catch (Exception e) {
e.printStackTrace();
}
}
Original comment by hirant...@gmail.com
on 27 Apr 2012 at 3:58
Closing following confirmation that there is no longer an issue.
Original comment by sype...@gmail.com
on 30 Apr 2012 at 6:09
Original issue reported on code.google.com by
hirant...@gmail.com
on 26 Apr 2012 at 8:55