0
votes

I've successfully integrated Parse.com to android app & the push notification was worked perfectly when i tried to send the notification from Data browser.

Now, when i tried to achieve to send the notification from device, it doesn't send anything & there's no log even in the Push notification section in Parse Data browser.

Also, i've enabled Client Push enabled in setting.

Here's my code :

public class ParseApplication extends Application {


    @Override
    public void onCreate() {
        super.onCreate();

        ParseCrashReporting.enable(this);
        Parse.enableLocalDatastore(this);
        Parse.initialize(this, "xxx", "xxx");
         ParsePush.subscribeInBackground("",new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
                } else {
                    Log.e("com.parse.push", "failed to subscribe for push", e);
                }
            }
        });
        ParseInstallation.getCurrentInstallation().saveInBackground();
        ParsePush parsePush = new ParsePush();
        parsePush.setChannel("Everyone");
        parsePush.setMessage("Helloooooo :)");
        parsePush.sendInBackground(new SendCallback() {
            @Override
            public void done(ParseException e) {

                Log.d("parse push","Parse push sent");
            }
        });
    }
}

In logcat, i received push notification sent successfully but it doesn't. Where i'm making the mistake?

1

1 Answers

0
votes

Ok. I found a solution. I think it's best to post in answer section for future searchers to easily find the solution.

The trick is, i removed this line

    parsePush.setChannel("Everyone");

and everything works now.

Initially, i though everyone is some special keyword that would send notification to all users since I've seen in a post where a user had this line in order to send broadcast notification to all registered user. But, the above line considers there's a channel everyone and it goes to only to that users who had subscribed to this channel (not all users).