5

I am building an application where users are able to interact with the contacts of their device(using phoneNumber) who have this application installed ( pretty much how Whatsapp, Viber function)

Now this functionality can be achieved by a function getContacts()

  1. Storing all app registrations on my server
  2. From the app, sending all contact to server and receiving in server response, the registered contacts

However, this leads to problems of synchronization in cases where contacts are added/deleted or existing ones are updated

For this, my knowledge guides me to three alternatives

  1. Everytime app is launched, call this getContacts() method so that the data retrieved is fresh
    • Not sure if this is the method used by Whatsapp & viber, its achievable but a lot of unnecessary processing during each launch
  2. Have a background Service poll the server through getContacts() method
    • This can keep contacts synchronized
    • However, this will not refresh changes instantaneously. In Whatsapp, if I change the name of a contact, it is reflected almost instantanouesly
  3. Register a ContentObserver on ContactsContract.CONTENT_URI ( Really not much of an idea on this )

Please provide your insights

Yashveer Rana
  • 548
  • 3
  • 15

0 Answers0