Git Product home page Git Product logo

Comments (11)

tibbi avatar tibbi commented on June 12, 2024 1

duplicate contact merging under the hood is a really messy thing, a contact could be merged from contacts with IDs like 3, 16 and 56. Do not change the way it is done now though, let's just use the ID that is used at showing the given contact on the main screen now.

from simple-contacts.

tibbi avatar tibbi commented on June 12, 2024 1

not sure, I guess I used 2 ways just as an extra check. Well, sorting by ID can have some glitches, but it is the best we can do so whatever :) Will be fixed in 6.15.1

from simple-contacts.

tibbi avatar tibbi commented on June 12, 2024

the only related field at contacts is LAST_TIME_USED

from simple-contacts.

qwertyfinger avatar qwertyfinger commented on June 12, 2024

@tibbi LAST_TIME_USED is deprecated from API 29 and not available in published apps on any API level.
https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#LAST_TIME_CONTACTED

There is a CONTACT_LAST_UPDATED_TIMESTAMP: https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#CONTACT_LAST_UPDATED_TIMESTAMP.

But judging from this StackOverflow answer, it's pretty useless since it gets updated all the time when some background sync happens without the user actually changing anything: https://stackoverflow.com/a/57489435

The only somewhat viable option seems to be keeping our own cache of hashcodes for contacts, periodically check if they have changed, and record the timestamp of when that happened. But it seems too complicated and error-prone for such a small feature.

from simple-contacts.

qwertyfinger avatar qwertyfinger commented on June 12, 2024

On the other hand – installed this app and it seems to sort by created date, and even shows some contact entry number: https://play.google.com/store/apps/details?id=ibtidah.tav.reco.
Will investigate further.
image

from simple-contacts.

tibbi avatar tibbi commented on June 12, 2024

well it has been updated in 2019 the last time, guess that field was still available. And as they arent updating targetSDK anymore, it still works. We have some locally stored contacts too that are fully under our control, but it isnt worth adding for them only. You can try fetching all fields with "*" and parsing through the whole cursor to see if there is nothing useful. We could rely on the "ID" itself too as we dont really need the date and time, just their order.

from simple-contacts.

qwertyfinger avatar qwertyfinger commented on June 12, 2024

Yep, I just confirmed that this is how this apps works – it just sorts by contact's ID.

from simple-contacts.

tibbi avatar tibbi commented on June 12, 2024

we can rely on that too. We won't be able to mix the public contacts and ones stored in "Phone storage (not visible by other apps)", but I dont think it matters. People usually dont mix those either, just use one or another.

from simple-contacts.

qwertyfinger avatar qwertyfinger commented on June 12, 2024

There are 2 different contact ID fields:

  1. RAW_CONTACT_ID - https://developer.android.com/reference/android/provider/ContactsContract.DataColumns#RAW_CONTACT_ID
  2. CONTACT_ID - https://developer.android.com/reference/android/provider/ContactsContract.RawContactsColumns#CONTACT_ID

Sometimes they contain different values, sometimes the same ones.
I tried sorting by both of them and RAW_CONTACT_ID seems to give correct results for much more contacts, although for some contacts comparison by CONTACT_ID is correct instead.
So I propose to use RAW_CONTACT_ID, although it's still not a perfect solution.

from simple-contacts.

qwertyfinger avatar qwertyfinger commented on June 12, 2024

@tibbi What's the purpose of this SQL sort function? To get at least partially sorted list of contacts and then sort them again using compareTo()? For example, if I change it to always return Phone.NUMBER, sorting still works the same as before.

from simple-contacts.

qwertyfinger avatar qwertyfinger commented on June 12, 2024

When syncing between devices, IDs seem to get changed too. So if you're moving to a new phone, your contact IDs will be recreated.

from simple-contacts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.