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

  • SEARCH
  • Home
  • 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 8425321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:14:18+00:00 2026-06-10T04:14:18+00:00

I’m working on developing an app for Android and need to store contact ID’s

  • 0

I’m working on developing an app for Android and need to store contact ID’s in order to keep track of a subset of contacts for use in the app. I’m currently storing the ID’s in a table that’s used locally, but this table becomes inconsistent if a contact is merged with other contacts (the ID used to represent the merged contact often changes). What is the best way to maintain consistency?

My ideas:

  • If there were some sort of intent or system event that is broadcasted then I could listen for that.

  • If the mapping between old ID’s and new ID’s is kept somewhere (ContactsContract.RawContacts?) then I could refresh the field whenever I detect that an ID is no longer valid.

  • Run a background process with a content observer and watch for changes. I’d like to avoid this if possible.

This question seems to tackle a similar problem, but for adding instead of merging contacts: Reacting to new contacts in Android Contacts application.

Any and all ideas welcome!

  • 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-10T04:14:20+00:00Added an answer on June 10, 2026 at 4:14 am

    Store the contact lookup URI (as a string). This URI is created from the _id along with the contact lookup_key. These two can build a lookup URI by calling ContactsContract.getLookupUri(). You can lookup the contact by calling ContactsContract.lookupContact() and querying CONTENT_URI or by querying CONTENT_LOOKUP_URI with the lookup URI directly. The Android docs say this about the CONTENT_LOOKUP_URI:

    A content:// style URI for this table that should be used to create shortcuts or otherwise create long-term links to contacts. This URI should always be followed by a “/” and the contact’s LOOKUP_KEY. It can optionally also have a “/” and last known contact ID appended after that. This “complete” format is an important optimization and is highly recommended.

    As long as the contact’s row ID remains the same, this URI is equivalent to CONTENT_URI. If the contact’s row ID changes as a result of a sync or aggregation, this URI will look up the contact using indirect information (sync IDs or constituent raw contacts).

    Lookup key should be appended unencoded – it is stored in the encoded form, ready for use in a URI.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from
I need a function that will clean a strings' special characters. I do NOT
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.