Book Image

PhoneGap for Enterprise

By : Kerri Shotts
Book Image

PhoneGap for Enterprise

By: Kerri Shotts

Overview of this book

Table of Contents (16 chapters)
PhoneGap for Enterprise
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Sending a Push via Boxcar


Sending a Push Notification can be done quite easily from the Boxcar console, but this isn't useful when we want these pushes to be sent automatically. Thankfully, Boxcar utilizes an HTTP API, which means we can generate a push from anything that can generate HTTP requests.

You'll need to obtain the Publisher Access Key and Publisher Secret Key to send a Push Notification programmatically. To do this, follow these steps:

  1. On the Dashboard, click on the gear icon for our Boxcar project.

  2. Click on Publishers.

  3. Click on Tasker API and you should be presented with a screen that contains the necessary keys as well as some example codes you can use. We have modified the Python example and placed it in /ch7/sendPush.

Sending a push boils down to this process:

  1. A push object is created, as follows:

    push = { "taskId": "21" , // custom data
      "f": "0",        // indicates if has rich content 0=no
      "i": "17327",    // id for push
      "badge": "auto", // badge (iOS) "auto" or a number...