Unable to roll-out my own, I am deciding to use Parse to send push notifications. I have been reading their tutorials. It is not clear to me how I might send pushes from App-Engine to specific users. I am dealing with the following scenario. A given user has five hundred friends. When said user updates her profile picture, the five hundred friends should receive a notification. How do I do something so simple? This is very simple stuff. So how do I do that with Parse? My server is Java App-engine. I need to know how do to the app-engine part. (aside: I have already successfully implemented app-engine to android push).
For some context, here is what I had on app-engine for Urban Airship.
try {
URL url = new URL("https://go.urbanairship.com/api/push/");
String appKey = “my app key”;
String appMasterSecret = “my master key”;
String nameAndPassword = appKey + ":" + appMasterSecret;
String authorizationHeader = Base64.encodeBase64String(nameAndPassword.getBytes("UTF-8"));
authorizationHeader = "Basic " + authorizationHeader;
HTTPRequest request = new HTTPRequest(url, HTTPMethod.POST);
request.addHeader(new HTTPHeader("Authorization", authorizationHeader));
request.addHeader(new HTTPHeader("Content-type", "application/json"));
request.addHeader(new HTTPHeader("Accept", "application/vnd.urbanairship+json; version=3;"));
log.info("Authorization header for push:" + authorizationHeader);
String jsonBodyString = String.format(JSON_FORMAT, deviceTokens.toString(), alert);
log.info("PushMessage payload:" + jsonBodyString);
request.setPayload(jsonBodyString.getBytes("UTF-8"));
URLFetchService urlFetchService = URLFetchServiceFactory.getURLFetchService();
HTTPResponse fetchedResponse = urlFetchService.fetch(request);
if (fetchedResponse.getResponseCode() >= 400) {
log.warning("Push notification failed:" + new String(fetchedResponse.getContent(), "UTF-8") +
"response code:" + fetchedResponse.getResponseCode());
} else {
log.info("PushMessage send success");
}
}
So the question really is, what does the Parse version look like?
I am not using Urban Airship because they want to charge me $200/month as starting fee: that's for zero push notifications. And then that money is supposed to increase as I send more pushes. (They just changed their pricing model). So I need an alternative; parse seems to have a good deal. I just don't know how to accomplish what I need yet.