I have created a application in android using parse.com to implement push notification. I get notification come successfully from server to my device when I triggers the push button in parse.com
Now My question is that how can I send the same notification from one device to another using parse.com
ParsePush push = new ParsePush();
push.setChannel("Giants");
push.setMessage("The Giants just scored! It's now 2-2 against the Mets.");
push.sendInBackground();
Related
I want to make an app where one user can ask for help and all other using this app will get that notification. I am using Parse.com for this as server. i am totally new to this please help me.I got registered my device by key etc. now i can send push notification from parse.com to my device.
but don't know how to make this on my device to send this to other devices?
You can create subscribe devices to different unique channel names, then you can send notification containing required payload to the device using the channel to which other device is subscribed.
//subscribing to channel
ParsePush.subscribeInBackground("Channel_Name");
//getting installed devices
ParseQuery pushQuery = ParseInstallation.getQuery();
//query for getting devices with channel name
pushQuery.whereEqualTo("channels", "Channel_Name");
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setMessage("Your message payload");
push.sendInBackground();
You can subscribe multiple devices to same channel, but in this case when notification is send , it will be sent to all devices subscribed to a particular channel.
For more info: https://parse.com/docs/android/guide#push-notifications
I have integrated the push notifications by Parse.
The notifications looks properly integrated as when I send them from the web end, I am able to receive them.
Now when I send the same push from Android nothing happens, here is a small code for the same:
ParsePush push = new ParsePush();
push.setMessage("Test");
push.sendInBackground(new SendCallback(){
public void done(ParseException pe){
Log.i(pe==null?"No exception":"Exception");
}
});
Since I am able to receive push from web it's confirmed they are well integrated.
Then what's the issue?
Assuming that you're using channels to send your push notifications, you just forgot to set the channel for your push notification. You just need to add:
push.setChannel(YOUR_CHANNEL_NAME);
I have an App in android with push notification, using Parse.
Push notification perfectly works through DashBoard
But not work if I use code from mobile:
ParsePush push = new ParsePush();
push.setChannel("Ch1");
push.setMessage(message);
push.sendInBackground();
I'm new to Android, I'm developing an application which is a little bit similar to WhatsApp, I have different users, and I want when a User send a message, other users should receive a Push Notification.
So when a user add a new message, when a value will be inserted to the class, all the users should receive Push notifications.
I know how to send a push notification from the console, but I want push notifications to be sent automatically.
Thanks
You can send push notifications with parse by using channels whereby each user subscribes to a set of channels and you can send pushes to particular channels.
OR
You can use advanced targeting in which you use the installation class to select the devices.
ParseQuery<ParseInstallation> pq = ParseInstallation.getQuery();
pq.whereEqualTo("area", message3);
pq.whereEqualTo("group", message2);
pq.whereNotEqualTo("key", value);
// Send push notification to query
ParsePush push = new ParsePush();
push.setQuery(pq); // Set our Installation query
push.setMessage("New Message");
push.sendInBackground();
Intent in = new Intent(Post.this,Notifications.class);
progress.dismiss();
startActivity(in);
OR
You can use cloud code to receive the data sent by the user and send push notifications to relevant devices
I am wondering how to send a parse push notification directly from my android app to evryone else using my app. Is it possible to do this?
If you want to use Parse, Go to parse dashboard and there you will see the settings for push where you will find this client-side push setting.
ParsePush push = new ParsePush();
String message = "Client message" + Integer.toString(i++);
push.setChannel("Channel Name");
push.setMessage(message);
push.sendInBackground();
You can send push notification from client side as metioned by #Dmitry
However parse strongly recommend not to use that feature [Security vulnerabilites issues]
Parse developers recommend "Cloud code" to send push notification to other users from your app.
Please read this
http://blog.parse.com/learn/engineering/the-dangerous-world-of-client-push/