One of the challenges with push notification is that each platform (Kindle, iOS, Android, Windows Phone/Desktop, Baidu) have different APIs and different requirements to send push notifications. Amazon SNS mobile push comes into play as a broker between your application’s back-end and the various push notification services so you can use a single API to send push notifications to ADM, APNS, GCM, MPNS, and other services.
Mobile push notifications’ free Tire is 1 million. And after that $0.50 per million.
HTTP/s service request’s free Tire is 100K, after that .75 per 100
Detail can be found here:
To receive push notifications from Amazon SNS, a mobile app needs to take three basic steps, regardless of the platform:
- The app starts and makes a device-specific request to register with the push service
- Upon successful registration, the push service returns a registration token, registration ID, a URI, or user and channel ID (dependent on platform).
- The registration token is sent to your Amazon SNS mobile push app and is registered as an endpoint. Amazon SNS mobile push needs that registration device token (iOS) so that it knows where to send notifications.
Development For Android
We will need:
- Android app registered with GCM
- Registration ID
- Server API key (sender auth token)
Create a Google API project and Enable the GCM Service. Configure current app and makes it work. This step does’t have much to do with Amazon, but with current App and Google.
Obtain the Server API Key. Amazon SNS will need server API key. This key will be let SNS Communicate with GCM on your behalf, and will be used later to send a push notification to a mobile end point.
The key will be provided by Google, in its API console.
Obtain a Registration ID from GCM
When register app with GCM, we will get this registration ID. Provide it to SNS and let it use this value to determine which app and associated device to send mobile push notifications to.
In App, we will need:
- Add this key to string.xml and name it as ‘project_number’.
- Modify AndroidManifest.xml.
- Include Google Play Service
Send a Push Notification Message to a Mobile Endpoint using GCM.
In this step, we will need actually writing some code server. Amazon provide a sample project as reference.
We will also need Security Credentials, which we should already have.
In code, we will need to specific registrationId, serverAPIKey, and application name.
Run the application onserver, if everything goes well it should work.