malavika
malavika

Reputation: 1331

How to send notification using parse for particular group members in android?

I have create an account in parse.com. I am using this single account for my three project.

I need to send notifications. Each application having different app name and package name.

my contents are in parse:

project 1

project 2

project 3

Here there are some channels are common this account. So the notification will send two projects at a time. Now i need to send notification for particular project with particular channel.

For example Now i need to send notification for physics in App1. How can i segregate that one.

My questions are:

  1. Is it possible to do? If yes means how?
  2. If it is not possible means whats is another way?
  3. May i create an separate account for each application? Is it correct way?

Any body can tell me? Thanks in advance.

Upvotes: 2

Views: 409

Answers (2)

engico
engico

Reputation: 453

Yes. Try This.

ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
query.whereEqualTo("appIdentifier", "com.example.app1");
query.whereEqualTo("channels", "physics"); 
push.setQuery(query);
push.setMessage("Hello");
push.sendInBackground();

Upvotes: 1

Muhammad Ali
Muhammad Ali

Reputation: 522

Yes you can use same Parse Account for multiple apps and send push directed for some specific app. In parse installation table there is an attribute (column ) appIdentifier which stores package name of app. So you can write query like this:

var query = new Parse.Query(Parse.Installation);
query.equalTo('appIdentifies', "App Package name")
query.equalTo('channels', 'your channel');
Parse.Push.send({
  where: query, // Set our Installation query
  data: {
    alert: "Willie Hayes injured by own pop fly."
  }
}, {
  success: function() {
    // Push was successful
  },
  error: function(error) {
    // Handle error
  }
});

Upvotes: 2

Related Questions