本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
移动推送 API 操作
要使用 Amazon SNS 移动推送 API,必须首先满足推送通知服务(如 Apple Push Notification Service (APNs) 和 Firebase Cloud Messaging (FCM))的先决条件。有关这些先决条件的更多信息,请参阅Amazon SNS 用户通知的先决条件。
要使用 API 将推送通知消息发送到移动应用程序和设备,必须首先使用 CreatePlatformApplication
操作,它返回 PlatformApplicationArn
属性。然后 PlatformApplicationArn
使用 CreatePlatformEndpoint
属性,返回 EndpointArn
属性。之后,可以在 EndpointArn
操作中使用 Publish
属性将通知消息发送到移动应用程序和设备,也可以在 EndpointArn
操作中使用 Subscribe
属性订阅主题。有关更多信息,请参阅 用户通知流程概述。
Amazon SNS 移动推送 API 如下:
CreatePlatformApplication
-
为设备和移动应用程序可能注册的受支持推送通知服务(如 APNs 和 FCM)之一创建平台应用程序对象。返回
PlatformApplicationArn
操作所使用的CreatePlatformEndpoint
属性。 CreatePlatformEndpoint
-
为受支持推送通知服务上的设备和移动应用程序创建终端节点。
CreatePlatformEndpoint
使用从PlatformApplicationArn
操作返回的CreatePlatformApplication
属性。EndpointArn
属性是使用CreatePlatformEndpoint
时返回的,它用在Publish
操作中将通知消息发送到移动应用程序和设备。 CreateTopic
-
创建可以发布消息的主题。
DeleteEndpoint
-
删除一个受支持推送通知服务上的设备和移动应用程序的终端节点。
DeletePlatformApplication
-
删除平台应用程序数据元。
DeleteTopic
-
删除主题及其所有订阅。
GetEndpointAttributes
-
检索设备和移动应用程序的终端节点属性。
GetPlatformApplicationAttributes
-
检索平台应用程序数据元的属性。
ListEndpointsByPlatformApplication
-
列出受支持推送通知服务中的设备和移动应用程序的终端节点和终端节点属性。
ListPlatformApplications
-
列出受支持推送通知服务的平台应用程序数据元。
Publish
-
向主题的所有订阅终端节点发送通知消息。
SetEndpointAttributes
-
设置设备和移动应用程序的终端节点属性。
SetPlatformApplicationAttributes
-
设置平台应用程序数据元的属性。
Subscribe
-
准备通过向终端节点发送确认消息来订阅终端节点。要实际创建订阅,终端节点所有者必须使用确认消息中的令牌调用 ConfirmSubscription 操作。
Unsubscribe
-
删除订阅。