PLSQL APPLE push notifiactions

痞子三分冷 提交于 2019-12-08 05:22:45

问题


I have a problem with notifications. I'm using Oracle apex with rest services.

How to send push notifications to APN iphone from pl/sql? Are you using Java in database?


回答1:


We successfully implemented the solution in our java code with java-apns

You create a service:

InputStream resourceAsStream = Thread
    .currentThread()
    .getContextClassLoader()
    .getResourceAsStream("Certificate.p12");

ApnsService service = APNS.newService()
    .withCert(resourceAsStream, "CERTNAME")
    .withProductionDestination()
    .build();

Then you create a payload:

String payload = APNS.newPayload()
    .sound("default")
    .alertBody(generatePushMessageBody(...))
    .customField("title", generateTitleForPushMessage(user))
    .customField("startDate", formatDateForPushMessage(...)
    .customField("username", user.getUserName())
    .build();

And then send the push notification:

service.push(registrationId, payload);

You need to put this code to a PL/SQL stored procedure and it will work.



来源:https://stackoverflow.com/questions/26041089/plsql-apple-push-notifiactions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!