Not able to send push notifications using Java SDK

0 votes

Hi,

We are trying to send push notifications to iOS device using the java SDK 2.6. The response comes as success, but it is not received at the iOS client. Please help us figure out the issue, below is code:

App42API.initialize(API_KEY,SECRET_KEY);  
pushService = App42API.buildPushNotificationService();
PushNotification pushNotification = pushService.sendPushMessageToUser(userName, message);
System.out.println("userName is " + pushNotification.getUserName());    
System.out.println("Message is " + pushNotification.getMessage());   
System.out.println("Expiry is"+pushNotification.getExpiry());  
String jsonResponse = pushNotification.toString();   
System.out.println(jsonResponse);

Below is the output:

userName is abc@gmail.com
Message is {"message":"Test Message"}
Expiry is2016-03-03T00:10:07.793Z
{"app42":{"response":{"success":true,"push":{"userName":"abc@gmail.com","message":{"message":"Test Message"},"expiry":"2016-03-03T00:10:07.793Z"}}}}
The user has a registered device and the manual push notifications from AppHQ management console work fine.
 
Do we need to configure the certificate or some keys in the code?
 
Thanks

 

 

asked Mar 3, 2016 in Java by jitesh.h.lalwani (20 points)

1 Answer

0 votes
Hi Jitesh,

 

Could you please share some information on this like your push logs when you are sneding this message from Java SDK what you getting inside Push logs section. Please click on Unified Notification -> Push - > Logs and please share the logs with us. It wlll help us to provide better support to you.

Regards,

Himanshu Sharma
answered Mar 3, 2016 by hs00105 (2,005 points)
Hi Himanshu,

We do not get anything in push logs while sending notifications from App HQ management console or via the code.

Thanks.
Have you enabled push logs from App Manager, If not, then please enable it by login to AppHQ management console and click on enable push log state and let me know if you are able to find it.

P.S Please make sure you have followed all the steps mentioned in tutorial like uploading certificate file for push in iOS device and secret key in Google project console.

Regards.
Himanshu Sharma
Hi,

We just enabled the logs and got the below after sending push notification from code given in first post:

" iOS Push notification sent successfully to: e3cb1519d912c36318d83e3772e493e2e3fd28d6a1177b202e286313781436cd"

Yes, we have followed the process here: http://api.shephertz.com/tutorial/Push-Notification-iOS/ to upload the .p12 file.

What do you mean by "secret key in Google project console"?

Also, we are getting the notifications when send from App42 HQ management console : https://apphq.shephertz.com/service/index#/pushUsers

So, we do not suspect an issue with certificate configuration. Please correct me if I am wrong.
Hi Jitesh,

Thanks for sharing the logs. It seems like there is an issue while showing push on the device side, because as you can see push has been sent from the server. So could you please share the sample project in which you experience this issue. It will help us to provide better support to you.

P.S: Secret key is required in case of enabling push in Android device.

Regards,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...