java - push notification has been successfully forwarded to apns but iphone does not receive any notification -
push notification getting forwarded com.notnoop.apns api succesfully not forward notification iphone.initially working fine , able receive notification same code stopped working. kindly suggest me if u have idea
my code :
if (!p12file.equals(null) && !password.equals(null)) { try { classloader classloader = getclass().getclassloader(); file file = new file(classloader.getresource(p12file).getfile()); if (file.exists()) { if (pushnotification.getpushservice().equals("apns")) { apnsservice service = null; if (pushnotification.getp12file().equals("dev")) { service = apns.newservice().withcert(file.getabsolutepath(), password).withsandboxdestination().build(); } else if (pushnotification.getp12file().equals("dis")) { service = apns.newservice().withcert(file.getabsolutepath(), password).withproductiondestination().build(); } deleteinactivedevices(service); string payload = apns.newpayload().alertbody(pushnotification.getmessage()).alerttitle(pushnotification.gettitlealert()). sound("default").customfield("secret", "what think?").build(); string token = pushnotification.getdevicetoken(); // system.out.println(service.hashcode()); service.testconnection(); apnsnotification ser = service.push(token, payload); system.out.println(ser); } else if (pushnotification.getpushservice().equals("gcm")) { system.out.println("gcm not implemented"); } message = "successfully send push notification message"; } } catch (exception e) { e.printstacktrace(); message = "cannot send push notification message"; } }
Comments
Post a Comment