跳到主要内容

推送通知服务

推送通知 (Push Notifications) 服务用于向用户发送有关 RainMaker 的事件通知。在安卓和 iOS 中使用这一服务分别需要在通知设置中配置 FCM 和 APNS 环境。

在安卓中配置推送通知服务

  1. 为安卓应用配置推送通知服务,请参阅推送通知设置

  2. 前往 Firebase 控制台选择您的项目。在左侧导航栏中点击齿轮图标,然后选择 Project settings

    firebase8

  3. 前往 Service accounts,点击 Generate new private key,请将其复制到剪贴板。

    firebase9

  4. 用管理员账号登录 RainMaker 管理面板。打开 Deployment Settings > Push Notifications

    push_notification12

  5. 创建新的平台应用程序。选择类型为 Google Notification

    push_notification13

  6. 输入步骤 3 复制的整个文件内容,点击 Save

    push_notification14

  7. 现在可以启用推送通知服务了,具体启用步骤请参阅启用通知推送


在 iOS 中配置推送通知服务

  1. 登录苹果开发者账号。

    push_notification1

  2. 启用此服务需要用 App ID。若尚未创建,请前往 Apple Developer 控制台创建新账号,具体步骤请参阅在苹果开发者控制台创建应用 ID

  3. 打开 Certificates 一栏,点击 +

    push_notification2

  4. 为推送通知服务创建新的证书,请选择 Apple Push Notification service SSL (Sandbox & Production) 并点击 Continue

    push_notification3

  5. 选择应用程序的 App ID 并点击 Continue

    push_notification4

  6. 接下来需要创建 Certificate signing request (CSR)

    push_notification5

  7. 打开 Keychain Access 工具栏,选择 Certificate Assistant > Request a certificate from a Certificate Authority

    push_notification6

  8. Certificate Assistant 对话框中,找到 User Email Address 一栏并输入电子邮件地址,CA Email Address 一栏无需填写。选择 Saved to disk 并点击 Continue 以保存证书。

    push_notification7

  9. 上传 CSR。

    push_notification8

  10. 证书已经成功创建,可以使用 Keychain Access 下载并查看。

    push_notification9

  11. Keychain Access 导出证书,格式为 p12

    push_notification10

    无需设置密码来保护导出的证书。

    push_notification16

  12. 启动通知推送需要 SSL Certificate 和 Private Key。 使用以下命令可获取 SSL Certificate。

    openssl pkcs12 -in yourP12Certificate.p12 -clcerts -nokeys

    使用以下命令可获取 Private Key。

    openssl pkcs12 -in yourP12Certificate.p12 -nocerts -nodes

  13. 用管理员账号登录 RainMaker 管理面板。打开 Deployment Settings > Push Notifications

    push_notification12

  14. 创建新的平台应用程序,选择类型为 Apple Notification (APNS)

    push_notification13

  15. 将步骤 12 中获取的 SSL Certificate 和 API Key 粘贴至此处,点击 Save

    push_notification11

    备注

    该证书也可用于沙盒和生产环境。沙盒环境用于测试通知和调试,APNS 用于分发。您可以重复步骤 13 和 14,选择类型为 APNS_SANDBOX,为沙盒环境设置推送通知。

  16. 现在可以启用推送通知服务了,具体启用步骤请参阅启用通知推送


启用通知推送

  1. 用管理员账号登录 RainMaker 管理面板。打开 Deployment Settings > Push Notifications

    push_notification12

  2. 使用切换键启用推送通知。您可以自定义启用推送通知的事件。

    push_notification15

    备注

    使用同样的切换键也可以禁用推送通知。

On this page