1

I need to send the push notification to android device, using GCM server library as done here for android devices: Link

Here is my code :

 Sender sender = new Sender(SERVER_KEY);
 Message message = new Message.Builder().timeToLive(30)
                            .delayWhileIdle(true).addData("messageKey", "abc")
                            .build();
 result = sender.send(message, regId, 1);

I get the error below while executing the the last line of my code.

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Could anyone suggest me something on how to resolve this issue?

almightyGOSU
  • 3,731
  • 6
  • 31
  • 41
Kedar Parikh
  • 807
  • 1
  • 14
  • 19
  • You just need to import required certificate. You can use `keytool` for that. Here's a similar question: http://stackoverflow.com/questions/6659360/how-to-solve-javax-net-ssl-sslhandshakeexception-error?answertab=votes#tab-top – Kay_N Jun 02 '15 at 22:42
  • @KayAnn : url which is used by this library provider is https://android.googleapis.com/gcm/send. This url has Geotrust Certificate which is public certificate right ? correct me if i am wrong. And it is already available in JRE/lib/security/cacerts file. So why am i getting this exception. – Kedar Parikh Jun 03 '15 at 06:29
  • That might not be the cert that you need or maybe outdated. Can you please verify both. – Kay_N Jun 04 '15 at 00:03
  • @KayAnn : i disable the ssl check as of now just to check whether its working fine without the ssl check or not. But even after disabling the ssl device is not getting the push notification. Though i am getting 200 response code and "id=0:1433497320698440%2c87a3dc00000030" as response from GCM.I checked the server api key and regId, but both are working fine in if i send from php code. Any suggestion ? – Kedar Parikh Jun 05 '15 at 09:45
  • In that case the provided code won't be sufficient to conclude anything. Please provide your client side implementation as well. Also note, you need different API key for client side application (in case you weren't aware). – Kay_N Jun 05 '15 at 22:22

0 Answers0