I have my app such that when entered in a certain activity, I show a list of contacts in my phone( similar to Chat app where you see a list of contacts when trying to start a new chat). So I just wanted to know about the implementation details of these task for best/ efficient work. Is the contact list is fetched everytime from my device whenever I enter the activity(which is actually redundant, because we maybe doing same work over and over again, But again we cannot rely on saved data in DB/SharedPref as contacts data is dynamic and bound to change, so need your expert suggestion how to actually make this work in best possible way(I have already written method to fetch contacts- so whould I fetch the contacts afresh everytime or any other way around is there, what the popular chat apps implemet to show the contacts everytime?
Should I store my contacts list in DB or Sharedpreference to avoid running the same task
27 Views Asked by Achy97 At
1
There are 1 best solutions below
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in SQLITE
- How to store a date/time in sqlite (or something similar to a date)
- How to copy data from SQLite to postgreSQL?
- When using a Room database on an Android application, is it possible to pre-populate data
- Expo Error - Android sqlite no such table
- how can debugg field id error in the database schema?
- How add array of authors for unique user in database in Goland IDE?
- Calculate SMA_Close10 and SMA_Close20 of minute data
- Transitioning from Static to Dynamic Data in React with Express Backend
- In SQLite, how to group ranges of values and sort the groups
- Issue with making python executable with local db, sqlite3, tkinter
- Calculating EuclideanDistance in SQL for Deepface facial embeddings?
- Problem with a simple query script used in RS Forms on Joomla 4
- Checking multiple user inputs to multiple fields in a sqlite3 database with python
- How to make that each seller has its own different set of products using sqlite and uwp
- peewee: SQLite - peewee Create() is forcing integer in PrimaryKeyField if leading character is numeric (even if there is a non-numeric in the middle)
Related Questions in ANDROID-CONTENTRESOLVER
- How to read all phone contacts in android faster?
- How to change type to image/*
- Querying relational data from ContentProvider
- Why is this variable set to empty string when it is already initialized to an empty string?
- Android Content Resolver takePersistableUriPermission API below 19 no such method
- Fetching a contact with lookupkey gives unexpected contat-id
- Unable to play MediaStore.Audio songs with MediaPlayer in android
- How to play songs from the Cursor in android?
- Check if file downloaded with DownloadManager still exist on device storage
- unable to decode ContentResolver.openInputStream(uri)
- Android: is ContentResolver instance thread-safe?
- Sporadic IllegalArgumentException: Unknown URL content://
- Conditional update within ContentProvider
- Appcelerator resolve uri
- Telephony.Sms.Inbox.PERSON uses deprecated Contacts.People._ID
Related Questions in ANDROID-CURSOR
- Do I need to close a Cursor if moveToFirst() is false?
- Cant access cursor from a class android
- How to get all SMS in android
- How to do a query with Cursor inside a thread? (android)
- View Pager setting the index to the last element on calling notifydatasetchanged()
- Creating Network Based Content Provider
- Error in searching a database for a particular record
- What is a Cursor and what does it do (in this case)?
- Cursor Loader Data not getting refreshed
- How to sort music files in cursor in android
- Recylerview, CursorAdapter with Header views in between
- android - Displaying the item clicked to a Listview populated by SQLite
- How to remove songs which has 0 duration in cursor in android
- moveToFirst does not work
- In Android SQLite, working directly with Cursor is more memory efficient than creating Model Objects?
Related Questions in CONTACT-LIST
- how to Get user's email friend list by using Google People API and with APIs Explorer
- gram-js/gramjs add contact to contact list by phone number
- How can I make my app read my contact list?
- Phone contact list with Qt
- How can I make a button that removes contacts once someone clicks on them, in Android?
- Should I store my contacts list in DB or Sharedpreference to avoid running the same task
- How do I attach separate PDF's to contact list email addresses using Python?
- how to show list contact phone in android studio with sdk 27
- Send a message to the telegram contact list of the user - Android
- blocked contacts in contact list IOS swift
- Manage contact list using Microsoft Graph
- UWP Contacts, Contact Lists and Contact Timelines
- Could you explain me this block of code? (Contact List)
- Contact List Android, showing only users who have installed the app
- Lazy loading existing contact images in Android
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Personally, I would implement the fetching of the contacts on a background thread (using coroutines) that is called periodically (perhaps each time they the activity is created, as you suggested, or maybe once when they open the app).
Because it's on a background thread, it would prevent them using the app (or any dropped frames while the activity is created). They might have thousands of contacts or be using a really slow device.
Presumably, you would want to store some other data associated with each contact: for example, if you opened up a chat with the user, you would want to associate all the messages with the user, so I would use a database such a realm rather than shared preferences.
So the entire process would probably look something like this: