Check for installed applications

I am creating an application in which users can interact with the contacts of their device (using phoneNumber) who have this application installed (mainly as a Whatsapp, Viber function)

Now this functionality can be done using the getContacts () function

  • Saving all application registrations on my server.
  • In the application, sending all contacts to the server and receiving the server’s response, registered contacts

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

To do this, my knowledge directs me to three alternatives

  • Each application starts, this getContacts () method is called so that the received data is fresh
    • Not sure if this is the method used by Whatsapp and viber, its achievable, but much unnecessary processing during each run.
  • You have a background poll of the server service through the getContacts () method
    • This can support contact synchronization.
    • However, this will not instantly update the changes. In Whatsapp, if I change the name of a contact, it is reflected almost instantly
  • Register ContentObserver at ContactsContract.CONTENT_URI (actually, this is not a good idea)

Please submit your ideas

+4
source share

Source: https://habr.com/ru/post/1496676/


All Articles