PLSQL APPLE 推送通知

2021-11-16 00:00:00 oracle plsql apple-push-notifications

我遇到通知问题.我将 Oracle apex 与休息服务一起使用.

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

如何从 pl/sql 向 APN iphone 发送推送通知?你在数据库中使用Java吗?

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

推荐答案

我们使用 java-apns

您创建了一个服务:

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

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

然后你创建一个负载:

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

然后发送推送通知:

service.push(registrationId, payload);

您需要将此代码放到 PL/SQL 存储过程中,它才会起作用.

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

相关文章