简体   繁体   中英

Send Parse Push to everyone from Android App

Maybe anyone can help me ! I want to send a push notification just to every registered device from a simple android app. (to everyone). There are working examples how to make this possible with php but i don´t know how to send a push notification to all (without channel) to all ?

I have found this information so far but its not working

My Channel is "" and the goal is to send a push to all devices !

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


  ParsePush push = new ParsePush();
        push.setQuery(pushQuery); // Set our Installation query
        push.setMessage("Hello world!");
        push.sendInBackground();

I have changed my code like this but it is still not working !

ParsePush.subscribeInBackground("bugatti", 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);
                }
            }
        });


  ParseQuery pushQuery = ParseInstallation.getQuery();
       pushQuery.whereEqualTo("channels", "bugatti");

   ParsePush push = new ParsePush();
      push.setQuery(pushQuery); 
        push.setChannel("bugatti");
        push.setMessage("Hello world!");
        push.sendInBackground();

Would be nice if anybody could help me !

You just need to enable "Sending Notifications".

  1. Go to Parse.com
  2. Go to settings
  3. Go to Push
  4. Go to "Client push enabled?"
  5. Set it on.

Enjoy!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM