My goal goal is to send push notifications to the iOS app via SNS. I turn to this guide: http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html .
I added AWS to my credentials and added apns to my credentials for my development key, certificate, private key and current input token for my application. When I run the tutorial, I get:
Exception in thread "main" java.lang.NullPointerException at com.amazonaws.sns.samples.tools.AmazonSNSClientWrapper.getValidNotificationAttributes(AmazonSNSClientWrapper.java:162) at com.amazonaws.sns.samples.tools.AmazonSNSClientWrapper.publish(AmazonSNSClientWrapper.java:80) at com.amazonaws.sns.samples.tools.AmazonSNSClientWrapper.demoNotification(AmazonSNSClientWrapper.java:131) at com.amazonaws.sns.samples.mobilepush.SNSMobilePush.demoAppleSandboxAppNotification(SNSMobilePush.java:438) at com.amazonaws.sns.samples.mobilepush.SNSMobilePush.main(SNSMobilePush.java:68)
At the top of SNSMobilePush.java there is a map called attributesMap. Initially, it has values equal to zero for the Platform.APNS and Platform.APNS_SANDBOX keys. These values never change anywhere during the code and are responsible for causing a null pointer exception. The workbook does not indicate a change in these values.
I have not done anything above or above the instructions for the textbook.
I know that my credentials are correct as I sent a message to my iOS application using the same credentials through the Amazon Management Console.
Can anyone point out
- if the textbook is incomplete
- what values related to Platform.APNS_SANDBOX must be met in order to get this working.
- any hint that will help me solve the problem with this
update I added a getValidNotificationAttributes () check to null, and now I can send push notifications using sns and apns using this tutorial.
amazon-web-services amazon-sns push-notification apple-push-notifications javaapns
miss.serena
source share