Friday, August 7, 2015

Push Notifications From A Query

JAVA

ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereEqualTo("State", "UT");

ParsePush push = new ParsePush();
push.setQuery(pushQuery);

// This next property is for Android and Windows Phone 8
push.title = "Sale in Utah";
push.setMessage("There is a sale in Utah today!");
push.sendInBackground();

SWIFT

let pushQuery = PFInstallation.query()
pushQuery.whereKey("State", equalTo: "UT")

let push = PFPush()
push.setQuery(pushQuery)

// The next properties are iOS only
let data = [
  "alert" : "There is a sale in Utah today!",
  "badge" : "Increment",
  "sounds" : "cheering.caf"
]
push.setData(data)
push.setMessage("There is a sale in Utah today!")
push.sendPushInBackground()

No comments:

Post a Comment