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()
- Storing all app registrations on my server
- 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
- 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
- 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
- Register a ContentObserver on ContactsContract.CONTENT_URI ( Really not much of an idea on this )
Please provide your insights