aws-sdk - AWS Pinpoint 中设备的终端节点是唯一的吗?

标签 aws-sdk aws-sdk-js aws-pinpoint

我是 Pinpoint 的新手,并试图了解端点/端点Id 如何在 Pinpoint 语义中工作。来自 aws doc :

When a user starts a session (for example, by launching your mobile app), your mobile or web application can automatically register (or update) an endpoint with Amazon Pinpoint.



这是否意味着每次启动应用程序时,都会有一个新的端点/端点 ID?如果当前 session 结束或用户终止并重新启动应用程序,它会注册一个新端点吗?

有没有办法以编程方式在应用程序中获取端点/端点 ID?

最佳答案

是的,端点对于每个独特的设备、电子邮件等都是相同的。它需要相同,以便亚马逊知道将推送通知发送到哪里,例如,如果您运行有针对性的事件。如果用户杀死并重新启动应用程序,则使用相同的端点。这适用于经过身份验证和未经身份验证的用户。因此,我有理由相信,如果当前 session 结束(即用户必须重新进行身份验证),那么它们具有相同的端点。这是有道理的,因为每个设备(设备本身)都需要一个唯一标识符。为了更好的回答您的问题,我亲自测试了以下内容并确认:

如果一个用户注销,另一个用户登录 [在 device],端点 ID 保持不变。以下代码的目的是向特定端点注册用户 ID。您还可以根据要求修改下面的代码以打印端点 ID。

假设您使用 Swift 和 AWS Cognito 进行用户身份验证,请在 AppDelegate 的顶部放置以下内容:

        var pinpoint: AWSPinpoint?

...在 didFinishLaunching 中,把这个:
        self.pinpoint = AWSPinpoint(configuration:AWSPinpointConfiguration.defaultPinpointConfiguration(launchOptions: launchOptions))
        if let targetingClient = pinpoint?.targetingClient {
                if let username = AppDelegate.defaultUserPool().currentUser()?.username {
                    let endpoint = targetingClient.currentEndpointProfile()
                    // Create a user and set its userId property
                    let user = AWSPinpointEndpointProfileUser()
                    user.userId = username
                    // Assign the user to the endpoint
                    endpoint.user = user
                    // Update the endpoint with the targeting client
                    targetingClient.update(endpoint)
                    print("Assigned user ID \(user.userId ?? "nil") to endpoint \(endpoint.endpointId).\n")
                }
            }

关于aws-sdk - AWS Pinpoint 中设备的终端节点是唯一的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52087550/

相关文章:

javascript - 将 ArrayBuffer 发送到 S3 放入 signedURL

angular - 在 angular5 中订阅和获取来自 SNS 的通知

android - 当应用程序在 Android 上处于前台时不显示 Amazon Pinpoint 推送通知

aws-lambda - 使用 CF 模板创建 AWS::Pinpoint::PushTemplate

aws-sdk - aws sdk中是否有节点的s3移动功能

ios - AWS Cognito 数据集同步限制 - 每组同步超过 1mb 时会发生什么

node.js - 使用 AWS JavaScript SDK 时临时切换 AWS 凭证

amazon-web-services - 如何选择重新通过 Amazon Pinpoint 接收 SMS 消息

node.js - 如何在 AWS Cognito 中创建身份提供商时启用 idp 注销流程?

amazon-web-services - 使用 aws-java-sdk-s3 时出错