WaveMaker Docs

WaveMaker Docs

  • Get started
  • Widgets
  • Mobile
  • How-to
  • Enterprise
  • Releases
  • Blog
  • Sign-in

›Mobile Integrations

Mobile Development

  • React Native or Cordova

React Native

  • Welcome
  • Features
  • Supported Widgets
  • Supported Variables
  • Test Run Preview
  • Debug Web Preview
  • Inspection Framework
  • Mobile Preview
  • Styles
  • Theme
  • Export as Zip
  • Build Installers
  • Debug APK
  • Debug IPA

Cordova

  • Building Hybrid Mobile Apps
  • Native Device Support
  • First Mobile App
  • Mobile Design

    • Mobile Page Design
    • Gesture Support
    • Mobile Tabbar
    • Mobile Navbar

    Mobile Installer

    • Test Run (Preview)
    • Debugging Mobile Apps
    • Test via Live Sync
    • Testing Hybrid Mobile Apps using WaveLens
    • Mobile Build - Android
    • Generating iOS and Android Distribution Certificates
    • Export Cordova zip
    • Mobile Build - Manual
    • Mobile Build - AppChef

    Mobile Integrations

    • Mobile Integrations - Amazon Mobile Analytics
    • Mobile Integrations - Amazon SNS
    • Using Push Notifications in Mobile Device
    • Invoking Web App APIs in Mobile Apps

    Offline Features

    • Offline Data Support
    • Implementation
    • Switching between Offline and Online Mode
Edit

Mobile Integrations - Amazon SNS


Amazon SNS is an AWS service that is used to enable push notifications for mobile devices. In this post, we will outline how to setup Amazon SNS with Google Cloud Messaging (GCM) and push messages to a device. In the end, this post will also show you how to integrate your WaveMaker mobile application with Amazon SNS service.

Source code:

The code used in this example is available for download here.

Prerequisites

  1. Amazon SNS account
  2. GCM account
  3. Device ID of the android phone to which the push notification will be sent.
  4. An application on the phone which will receive the notification

Setup Amazon SNS with GCM and an Android device

  1. Navigate to Amazon SNS console at https://console.aws.amazon.com/sns/v2/home
  2. Click on “Create topic” to give it a name
  3. Save the new topic. It should appear in the list
  4. Navigate to “Applications” and create a new application:. Choose “Google Cloud Messaging (GCM)” option. You will also need to provide your GCM API key
  5. Select the newly created Application and click on “Create platform endpoint”. You need to fill in your device’s token and a user-readable name
  6. Once the application's endpoint is created, select your device and click “subscribe endpoint to topic”
  7. Enter your Topic ARN. You can copy the ARN from the Topics section.

Publishing a push notification to the device

  1. Navigate to topics.
  2. Select your topic and click “Publish to topic”
  3. Give the message a subject and choose JSON format radio button. Click on “JSON message generator”
  4. Type your message and click on “Generate JSON” message.
  5. SNS will generate a JSON payload with message structure for all messaging platforms it supports. It is safe to ignore the other formats for now ( since we have not configured any services other than GCM). Take a note of the GCM message and click on Publish message when you’re ready to send the message
  6. The message will appear as a Push Notification on your device

Push message via SNS from WaveMaker

  1. Setup the Amazon Javascript SDK in WaveMaker. Refer to the WaveMaker/Amazon Cognito blog post for details. The setup steps are common for all Amazon services.
  2. In the $scope.onPageReady = function() {} block, type the following code:
  3. You should receive a push notification on your device with the subject.

Additional Information

  1. All the setup steps outlined in this document ( setting up Topics, Subscriptions etc) can be done via Amazon SNS UI as well as the API
  2. The official API reference is available at https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html and it is highly recommended to go through it.
  3. A user can be restricted or allowed to post information to SNS via Amazon’s IAM policies. This is outlined at https://docs.aws.amazon.com/sns/latest/dg/UsingIAMwithSNS.html#d0e3147
  4. In this document, we dealt with the Amazon JavaScript SDK. It is also possible to accomplish all these steps using the Amazon Java SDK. The official documentation is at https://docs.aws.amazon.com/sns/latest/dg/using-awssdkjava.html

See Also

Amazon Mobile Analytics
Push Notifications
Invoking Web App APIs in Mobile Apps

Last updated on 5/18/2020 by Naresh Ravulapalli
← Mobile Integrations - Amazon Mobile AnalyticsUsing Push Notifications in Mobile Device →
  • Source code:
  • Prerequisites
  • Setup Amazon SNS with GCM and an Android device
  • Publishing a push notification to the device
  • Push message via SNS from WaveMaker
  • Additional Information
  • See Also
WaveMaker
  • PRICING
  • PARTNERS
  • CUSTOMERS
  • ABOUT US
  • CONTACT US
Terms of Use | Copyright © 2013-2023 WaveMaker, Inc. All rights reserved.