Displaying device contacts with an indication that the contact is registered to the app
- by Prasanna Aarthi
We are developing a mobile app that needs to pick up device contacts, display them and indicate if the contact has already registered with this app. We have our DB in the server and the app fetches data using web services. What will be the best approach to implement the above scenario taking performance into consideration.
Option 1:
Every time user opens the app,fetch the contacts and send the list of email addresses to the server, check with the registered email ids and return the list of registered users in the contact list. In this approach whenever user opens the particular page, he needs to wait for few seconds to load data, but the contacts will be the latest from the device.
Option 2:
First time when the user opens the app, fetch contacts ,send the entire list of contacts and save it in the DB, retrieve list of registered users in the contacts then save this to local DB.
From now on, data will be fetched from local DB and displayed.
When a new user registers in the app, again check with records in central DB and send list of new users who are in your contacts that have registered to your app.
This list will be added to local DB. and the process continues.
In this case the new contacts added by user will not be updated in the app but retrieval and display of records would be quick.
What would be the correct approach? In case there is a better way of doing this, please let me know.