-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,20 @@ | ||
# gcm Module | ||
# Titanium Module for Google Cloud Messaging Push Notifications for Android # | ||
|
||
## Description | ||
A Titanium module for registering a device with GCM and handling push notifications sent to the device. | ||
|
||
TODO: Enter your module description here | ||
1. Install the module as usual in Titanium Studio by downloading the [zip file](https://github.com/morinel/gcmpush/releases/download/1.0/nl.vanvianen.android.gcm-android-1.0.zip) | ||
1. Refer to the example for possibilities | ||
1. Send a server push notification with your preferred server-side technology to the registrationId returned while registering your device. | ||
1. The callback you specified will then be called | ||
|
||
## Accessing the gcm Module | ||
This module does not require any tiapp.xml properties, all configuration is done in Javascript. | ||
|
||
To access this module from JavaScript, you would do the following: | ||
There are four notification settings that can be specified: | ||
|
||
var gcm = require("com.activate.gcm"); | ||
1. sound: the sound file to play while receiving the notification or 'default' for the default sound. The sound file should be placed in platform/android/res/raw directory. | ||
1. smallIcon: the tiny icon shown at the top of the screen, see this [stackoverflow question](http://stackoverflow.com/questions/28387602/notification-bar-icon-turns-white-in-android-5-lollipop) for details. The file should be placed in platform/android/res/drawable | ||
1. largeIcon: the large icon shown in the notification bar. If not specified your appicon will be used. The file should be placed in platform/android/res/drawable. | ||
1. vibrate (true / false): whether vibration should be on | ||
|
||
The gcm variable is a reference to the Module object. | ||
|
||
## Reference | ||
|
||
TODO: If your module has an API, you should document | ||
the reference here. | ||
|
||
### ___PROJECTNAMEASIDENTIFIER__.function | ||
|
||
TODO: This is an example of a module function. | ||
|
||
### ___PROJECTNAMEASIDENTIFIER__.property | ||
|
||
TODO: This is an example of a module property. | ||
|
||
## Usage | ||
|
||
TODO: Enter your usage example here | ||
|
||
## Author | ||
|
||
TODO: Enter your author name, email and other contact | ||
details you want to share here. | ||
|
||
## License | ||
|
||
TODO: Enter your license/legal information here. | ||
If the app is not active when the notification is received, use gcm.getLastData() to retrieve the contents of the notification and act accordingly to start or resume the app in a suitable way. If you're done, call gcm.clearLastData(), otherwise the same logic will happen when resuming the app again. |