Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRawan Hamad
592 Pointshow to fix getRecepiantsId()
what if my app contains followers and followings and commenting on other people who's not following me and I'm not following them, like instagram for example.
how would I fix the getRecipiatIds() method ..
Rawan Hamad
592 PointsHey Vrezh Gulyan , yes exactly .. and I have one more question. why do we have to use the installation to push notifications ? can't we use the userId from User class directly ?
1 Answer
Vrezh Gulyan
11,161 PointsWell for the first part:
Lets say you have a like button and a post button for comments. In the onClick listeners for each of these buttons you could record the userId for these people even if they aren't of your friends. So each time a person likes or comments you get notified and their userId is recorded. Furthermore if lets say you want to notify them if you comment back to their comment you'd be able to. You can do it like Facebook does it where when you comment on someones picture you get notified whenever anyone else does too. Off the top of my head I can see this simply being done by keeping an array of userId's of anyone who commented on a certain picture and as soon as someone comments send a notification to all these people.
As far as why use installation for push notification it has to do more technical parts of each individual phone that you send notifications to. When you install on each individual phone it stores all the needed data to send notifications, technical phone information, what categories of push messages to send etc. Then from the parse.com website in the push category you can target specific phones without knowing userId's. Like when installing you can set whether each user wants to get comment notifications or not ( they can also change this themselves in settings) that way when you send push notifications you can send it to everyone and let the installation part that we did earlier take care of who gets what.
Vrezh Gulyan
11,161 PointsVrezh Gulyan
11,161 PointsHey Rawan,
Your question is how would you go about sending push notifications to users who aren't part of your friends list?