Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:37:11+00:00 2026-06-14T22:37:11+00:00

I realize this has been somewhat touched upon in various places including here on

  • 0

I realize this has been somewhat touched upon in various places including here on Stack Overflow, but I’m looking for any other solutions that people might have used. So with that in mind…

I’m developing an application where a user can initially sync all his contacts with a desktop application OTA. This is done through a web service call that grabs a set of 100 contacts from the server, downloads and parses the information, inserts the contacts into the Android Contact DB, acknowledges receipt of these contacts, and then repeats the previous steps with the next set of 100 contacts until the sync is complete. This process works well when a user has contacts on the order or 1000-2000, but a typical user of this application can easily have 5000-6000 contacts (with power users having upwards of 10000+) in which case things take far longer than I’d like. For example, a sample set of approximately 5300 contacts can take about 13.5 minutes to complete. Not bad, but I’d like it to be at least as efficient as iOS which runs about 8 minutes for the same data set if possible.

I’ve logged the time it takes for each step and, unsurprisingly, the bottleneck appears to be with inserting the data into the Android contract DB. After scouring the web I’ve found little help with regards to inserting thousands of contacts, but what I have found seems to fall into these three groups:

1) ContentProviderOperation — The Google recommended way which gave me my baseline of 13.5 minutes for 5300 contacts.

2) Bulk Inserts — I read that builkInsert tends to be more efficient than applyBatch, but when I tried to implement this myself it actually took 25 minutes for the same 5300 contacts. I have a feeling a lot of this is due to the fact that I need to insert the RawContact information and then save the resulting URI for use in creating the ContactsContract.Data for the bulkInsert which comes more naturally via the backValueReference in the ContentProviderOperation. Additionally, I looked at the android source code and I don’t get the feeling that bulkInsert is terribly efficient.

3) Creating an optimized bulk insert using the DatabaseUtils.InsertHelper and transactions — Unfortunately, this seems geared towards those people who created their own content provider because you need access to the underlying DB as an instance variable and I’ve yet to see how that could be done with the native contacts DB.

Does anyone have any experience with inserting 5000+ contacts or any other possible ideas I could look into to help reduce my time? Or should the ContentProviderOperation be considered as optimized as it’s going to get?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:37:12+00:00Added an answer on June 14, 2026 at 10:37 pm

    Unfortunately, I believe 1 is the best option. I suspect a majority of your overhead in comparison to iPhone is in the cross process IPC inherent to the content provider design.

    Your analysis of 3 is correct.

    There are options on rooted devices to go around the content provider but I doubt that is what you are looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that this question has been asked and has been answered here but
I realize this question has probably been asked numerous times, but I have not
I realize that this question has been asked 100times but none that I have
I realize something like this has been asked, but this may be a little
While I realize that this question has been asked once or twice ago but
I realize this question has been asked and answered in the past, but I'm
FIRST: I realize this question has been asked here: in ExtJS, is it better
I realize this has been asked before, but I wasn't able to find a
I realize this question has been asked several times, but I wanted to frame
I realize this question has been asked before, but I can't get it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.