user717452
user717452

Reputation: 111

Parse Push Notifications When Specific Users Make Post

I recently updated an app to be configured with back-end server at Parse. They login using either username, twitter credentials, or Facebook credentials. From there, they can make some 'posts', which just add a row to an object I have set up in the Parse dashboard.

I know that Parse has some push notification capabilities, but I was wondering about one specific use. Is there a way for a user to 'follow' another user, and receive a Push Notification every time that user posts something? If so, is that something that can be handled via Native Parse and iOS functions, or must Cloud-Code be set up for that?

Upvotes: 0

Views: 264

Answers (1)

Björn Kaiser
Björn Kaiser

Reputation: 9912

This can be achieved using client-side push (which you would have to enable in your app settings on Parse in case it is disabled).

You can then use this code to send pushes from the device of the user creating the post to all of his followers:

// Send a notification to all devices subscribed to the "Giants" channel.
PFPush *push = [[PFPush alloc] init];
[push setChannel:/* Set the channels here */];
[push setMessage:@"User XYZ just posted something"];
[push sendPushInBackground];

https://www.parse.com/docs/push_guide#sending/iOS

Upvotes: 2

Related Questions