Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions cloud/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ Parse.Cloud.define('pushChannelTest', function(request, response) {
var params = request.params;
var user = request.user;

// extract out the channel to send
var action = params.action;
var message = params.message;
// To be used with:
// https://github.com/codepath/ParsePushNotificationExample
// See https://github.com/codepath/ParsePushNotificationExample/blob/master/app/src/main/java/com/test/MyCustomReceiver.java
var customData = params.customData;
var launch = params.launch;
var broadcast = params.broadcast;

// use to custom tweak whatever payload you wish to send
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo("deviceType", "android");

var payload = {"data": {
"alert": message,
"action": action,
"customdata": customData}
};
var payload = {};

if (customData) {
payload.customdata = customData;
}
else if (launch) {
payload.launch = launch;
}
else if (broadcast) {
payload.broadcast = broadcast;
}

// Note that useMasterKey is necessary for Push notifications to succeed.

Expand Down