0

I need some information regarding what I'll be needing to implement and how if I would like to do the following:

lets say me and my friend/s both have my app installed on the iphone, in the app I would like to have a "contacts" bar and see that he is also using this app, then select my friend or even more people and send him/them a push notification with my own custom object, that will have the app do a bunch of actions on their end.

heres what i thought: I'm guessing I'll need to have my own server, register each user's device token in the server database, but can the push notification maybe contain a json value that I can then parse on the end users device ? or maybe theres a simpler way of transferring objects and information between one to one/many devices ?

any tutorials/ideas/advice ?

Eden V.
  • 973
  • 1
  • 6
  • 10

1 Answers1

0

What I would do is the following:

Create a push notification server that receives the device tokens and store them into a database. I would also link this tokens with a username and password (optional).

In order to see what users are logged in you would need a server call that your app will cal whenever the user opens the app (or logs in, depending on what you want). When the user logs in and performs the call to your server, I would send a push notification with a log in "event" to all his friends. (so that they know he is logged in)

Then for sending custom objects/events to a friend you will need another server call that will receive a JSON or just a parameter (this call can be POST/GET) depending on what you want. When the server receives this call, a notification is sent only to the selected friends with the custom object as JSON in your notification payload.

Side Notes:

  1. Push notification payload are limited in size, but the size is not well documented, on some formus/blogs it appear the size can be 256 bytes on other 107, for this you will have to experience.

  2. Push notification order is not reliable, you can't be sure that the notification number 2 will arrive after the notification number 1.

danypata
  • 9,895
  • 1
  • 31
  • 44