Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 2.59 KB

README.md

File metadata and controls

52 lines (33 loc) · 2.59 KB

Sending push notifications from Web app to Android devices (via GCM) and iOS devices (via APNS)

A showcase demo and a quick tutorial of PhoneGap and PubNub data stream network JavaScript API, using a simulated Smart room heater (à la Nest) web user-interface to give you some use case ideas.

photo

How to try the demo

This demo is only available for Android devices, due to the lack of openness of iOS app development.

There are two parts of demo- an Android app, and a web app. First you access to the Android app to obtain your Registration ID, then you pair the device with the desktop app to be able to receive push notifications.

Android Instruction

  • Download this apk and install it on your Android device
  • Once your device is registered to this demo, you should get your 8-digit unique ID

Desktop Instruction

  • Go to pubnub.github.io/iot-push-demo
  • Enter your 8-digit ID in the input box
  • Hover cursor over the temperature controller UI, and use mousewheel or trackpad to change the value
  • When you set the room temperature above 80F, it sends you a push notification to your Android device

Source Code

This repo is for the web app only, however, I included the code to be used for Cordova/PhoneGap app under cordova folder. The index.js file should be in your_cordova_app_root/www/js to build as an Android native app.

Tutorials

I wrote a series of step-by-step instructions on how to send push notifications using Cordova plugin and PubNub APIs:

Also, I have PhoneGap/Cordova 101 tuts: