Mobile push notifications best practices - Amazon Simple Notification Service

Mobile push notifications best practices

This section describes best practices that might help you improve your customer engagement.

Endpoint management

Delivery issues might occur in situations were device tokens change due to a user’s action on the device (e.g. an app is re-installed on the device), or certificate updates affecting devices running on a particular iOS version. It is a recommended best practice by Apple to register with APNs each time your app launches.

Since the device token won’t change each time an app is opened by a user, the idempotent CreatePlatformEndpoint API can be used. However, this can introduce duplicates for the same device in cases where the token itself is invalid, or if the endpoint is valid but disabled (e.g. a mismatch of production and sandbox environments).

A device token management mechanism such as the one in the pseudo code can be used.

Delivery status logging

To monitor push notification delivery status, we recommended you enable delivery status logging for your Amazon SNS platform application. This helps you troubleshoot delivery failures because the logs contain provider response codes returned from the push platform service. For details on enabling delivery status logging, see How do I access Amazon SNS topic delivery logs for push notifications?.

Event notifications

For managing endpoints in an event driven fashion, you can make use of the event notifications functionality. This allows the configured Amazon SNS topic to fanout events to the subscribers such as a Lambda function, for platform application events of endpoint creation, deletion, updates, and delivery failures.