I have been trying to send a simple push notification from one device to the other using parse and I am with no luck.
Lets say I have a twitter clone that has follow/unfollow feature, if for instance User-A begins to follow User-A all I am trying to do is notify User-A that he is now being followed by User-B
This is the simple code that I am running
ParseQuery query = ParseInstallation.getQuery();
query.whereEqualTo("userId", "0VZF1l5qyA");
// Notification for Android users
ParsePush androidPush = new ParsePush();
androidPush.setMessage("Your suitcase has been filled with tiny robots!");
androidPush.setQuery(query);
androidPush.sendInBackground();
Just to even make sure that it works, I hard coded the value in but still nothing is being sent. And it also not like the user that I am trying to target is not on the server.
This how my installation table looks
I think something as simple as this should just work. Or maybe I missing how push notifications work. By the way I am able to send push notifications from the Parse web app. FYI - I have read the entire section of this and still not getting it to work.
Addendum: I have this block of code in my main activity and modified my manifest to look like this.
// Associate the device with a user
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("user",ParseUser.getCurrentUser());
installation.put("userId",ParseUser.getCurrentUser().getObjectId());
installation.saveInBackground();
By default clients are not allowed to push notification. You MUST do the following else your app wont work!!
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.