【问题标题】:How many users have push notifications enabled?有多少用户启用了推送通知?
【发布时间】:2019-11-04 17:31:12
【问题描述】:

我有一个有很多用户的 SAAS 产品。 iOS + Android 应用。

1) 有没有办法检查其中有多少人启用了推送通知?

2) 我能否以编程方式检查他们是否启用了推送?如果没有,那么我想触发替代沟通。

问题适用于 iOS 和 Android。

谢谢。

【问题讨论】:

  • 在 iOS 上,您的应用可以检查是否已被授予通知权限,但用户可以随时撤销权限,您无法检查,直到他们再次运行您的应用。

标签: android ios push-notification


【解决方案1】:

iOS版

您必须实施智能解决方案才能完成这项工作。

初始点是识别一个权限用户。

作为回复:https://stackoverflow.com/a/44407514/6273003

之后,您可以使用一些用户标识来存储此信息。

然后,当您决定通知时,您必须检查此信息。

PS : 正如@paulw11 所说,此权限是动态的。

【讨论】:

    【解决方案2】:

    对不起,我只回答了 iOS 部分
    我认为您需要知道哪些用户会收到通知消息,如果用户没有收到消息,请使用替代 chanel 向其发送消息。
    可以(在 iOS 中)使用通知扩展
    只需使用 api 请求添加发送交付状态(在您的服务中)

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
    let content = request.content
    // send delivery status in your service
    sendStatistic(content: request.content, onCompletion: {
        // show push with default content
        contentHandler(content)
    })
    

    }

    一些带有扩展名的指南
    https://code.tutsplus.com/tutorials/ios-10-notification-service-extensions--cms-27550
    有关扩展的更多信息 https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension
    关于通知的更多信息
    https://developer.apple.com/notifications/

    【讨论】:

      猜你喜欢
      • 2014-03-31
      • 2010-12-04
      • 1970-01-01
      • 2018-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多