title: Send parse push notification on button click android
body: <p>What I need is when the user clicks on a button, a push notification will be sent to all users using this app.
  I tried using this code in a setOnclickListener method, but nothing was sent after clicking on it.</p>
  
  <blockquote>
    <p>Note: Sending a push notification from Parse Dashboard works perfectly
    fine.</p>
  </blockquote>
  
  <pre><code>        ParsePush parsePush = new ParsePush();
          ParseQuery query = ParseInstallation.getQuery();
          parsePush.setQuery(query);
          parsePush.setMessage("A new file has been Updated. Check it out!");
          parsePush.sendInBackground(new SendCallback() {
  
              @Override
              public void done(ParseException arg0) {
                  // TODO Auto-generated method stub
                  Log.d(TAG, "SendCallback success:");
                  if(arg0 == null)
                  {
                      Log.d(TAG,
                              "suceess push notification :");
                  }
                  else
                  {
                      Log.d(TAG,
                              "failed push notification  :"
                                      + arg0.getMessage());
                  }
              }
          });
      }
  });
  </code></pre>
  
  <p><strong>- EDIT - in response to Bradley Wilson's answer</strong>
  - this still did not work</p>
  
  <pre><code>ParsePush parsePush = new ParsePush();
  ParseQuery&lt;ParseInstallation&gt; parseQueryInstallation = ParseQuery.getQuery(ParseInstallation.class);
  parsePush.setQuery(parseQueryInstallation);
  parsePush.setMessage("A new file has been Updated. Check it out!");
  parsePush.sendInBackground(new SendCallback() {
  
      @Override
      public void done(ParseException arg0) {
          // TODO Auto-generated method stub
          Log.d(TAG, "SendCallback success:");
          if(arg0 == null)
          {
              Log.d(TAG,
                      "suceess push notification :");
          }
          else
          {
              Log.d(TAG,
                      "failed push notification  :"
                              + arg0.getMessage());
          }
      }
  </code></pre>
  
  <p><strong>- EDIT 2 - in response to Suresh Kumar's answer</strong>
  - For some reason, cloud code never works in my projects. It just doesn't identify any Cloud code and keeps it in red <a href="https://i.stack.imgur.com/BStZe.png" rel="nofollow noreferrer">as shown in this image</a></p>