Android Push Notifications with Parse.com

Update: Parse is shutting down. So you should start migrating.

If you want to send messages upstream and downstream from your Parse backend to your app and vice-versa then thankfully Parse does allow you to do that. Parse allows you to send unlimited push notifications to 1 million unique recipients (devices). Then they charge $0.05 per 1000 recipients extra. That’s awesome!

What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.

Check out the following guides to completely learn how to setup, send, receive, etc. Push Notifications:

The best part about using Parse for Push Notifications is that you won’t have to deal with the GCM (Google Cloud Messaging) setup that you’ve to do otherwise or when working with PubNub.

Here’s a sample piece of code that shows how to subscribe to a channel and then send a push notification to all the apps subscribed to that same channel:

ParsePush.subscribeInBackground("Giants", new SaveCallback() {
    @Override
    public void done(ParseException e) {

        if (e == null) {
            JSONObject data = null;
            try {
                data = new JSONObject("{\"alert\": \"Long Notification message!\", \"title\": \"Notification Title\"}");
            } catch (JSONException je) {
                je.printStackTrace();
            }

            ParsePush push = new ParsePush();
            push.setChannel("Giants");
            push.setData(data);
            push.sendInBackground();
        }
        else {
            e.printStackTrace();
        }
    }
});

Parse gives you a lot more control and flexibility than this simple piece of code. Just go through the documentation links above.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Author: Rishabh

Rishabh is a full stack web and mobile developer from India. Follow me on Twitter.

Leave a Reply

Your email address will not be published. Required fields are marked *