From fb3ef35d8b24125e146facc5c6179d1843d3f2ec Mon Sep 17 00:00:00 2001 From: Timan Rebel Date: Mon, 27 Oct 2014 11:28:57 +0100 Subject: [PATCH 1/3] Update README.md --- android/README.md | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/android/README.md b/android/README.md index 738760d..7d10b04 100644 --- a/android/README.md +++ b/android/README.md @@ -18,26 +18,45 @@ we need to put the application id and client key from Parse in your **tiapp.xml* ```xml abcdefg - hijklmnop + hijklmnop ``` Put the following code in your app.js (or alloy.js if you are using Alloy) to access the module in Javascript. ```javascript var Parse = require('eu.rebelcorp.parse'); + Parse.start(); ``` -To enable Android Push Notifications +To handle received notifications the moment it arrives at the Android phone ```javascript - Parse.enablePush(); + Parse.addEventListener('notificationreceive', function(e) { + Ti.API.log("notification: ", JSON.stringify(e)); + }); ``` -To handle received notifications +To handle a click on a notification ```javascript - Parse.addEventListener('notification', function(e) { - Ti.API.log("notification: ", JSON.stringify(e)); + Parse.addEventListener('notificationopen', function(e) { + Ti.API.log("notification: ", JSON.stringify(e)); + }); +``` + +These events are only fired when the app is running. When the app is not running and a notification is clicked, the app is started and the notification data is added to the launching intent. It can be accessed with the following code: + +``` + var data = Ti.App.Android.launchIntent.getStringExtra('com.parse.Data'); + + if(data) { + try { + var json = JSON.parse(data); + + // Now handle the click on the notification + } + catch(e) {} + } ``` Subscribe or unsubscribe to Parse Channels @@ -47,14 +66,16 @@ Subscribe or unsubscribe to Parse Channels Parse.unsubscribeChannel('user_123'); ``` - ## Known Issues -* Not all of the API is exposed at the moment -* Incoming Push Notifications are not exposed when clicked upon - +* None ## Changelog +**[v0.5](https://github.com/timanrebel/Parse/releases/tag/0.5)** +- Upgraded to latest Parse SDK +- Changed events from `notification` to `notificationreceive` and `notificationopen` +- Added `com.parse.Data` to launching intent + **[v0.3](https://github.com/timanrebel/Parse/releases/tag/0.3)** - Fire `notification` event when new notification is received. From 95cb9f88c4308b09088d959b87605ed27929d1b2 Mon Sep 17 00:00:00 2001 From: Timan Rebel Date: Tue, 11 Nov 2014 09:34:19 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 8513931..a5fafa4 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,6 @@ Appcelerator Titanium module for the Parse SDK. This module currently only support Android Push Notifications. iOS is work in progress and not ready for production -## Usage - -### Get it [![gitTio](http://gitt.io/badge.png)](http://gitt.io/component/rebel.parse) -Download the latest [distribution ZIP-file](https://github.com/timanrebel/Parse/releases) and consult the [Titanium Documentation](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_a_Module) on how install it, or simply use the [gitTio CLI](http://gitt.io/cli): - -`$ gittio install rebel.parse` - ## Documentation -Check the readme in the platform specific [folder](https://github.com/timanrebel/Parse/tree/master/android). +Check the readme in the platform specific folders. From a4dc037e8d27dd4caa34ca48b0d2eab769b270bf Mon Sep 17 00:00:00 2001 From: Timan Rebel Date: Tue, 11 Nov 2014 09:36:18 +0100 Subject: [PATCH 3/3] Update README.md --- android/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/README.md b/android/README.md index 7d10b04..30cacfc 100644 --- a/android/README.md +++ b/android/README.md @@ -14,13 +14,15 @@ Download the latest [distribution ZIP-file](https://github.com/timanrebel/Parse/ ### Example Because the module needs to load and initialize during the startup of your Application to properly support Push Notifications, -we need to put the application id and client key from Parse in your **tiapp.xml** file: +we need to put the application id and client key from Parse in your `tiapp.xml` file: ```xml abcdefg hijklmnop ``` +**Please note:** You should not add any other Parse tags to your `manifest` section in your `tiapp.xml` file, this module does this all for you. If you do, it will result in displaying Push Notifications multiple times. + Put the following code in your app.js (or alloy.js if you are using Alloy) to access the module in Javascript. ```javascript