0

Anyone knows how to get or fetch real time contacts in react native. I used react-native-contacts library. first of all i'm getting my all contacts in app. but suppose if i change any contacts name in my phone then it should be updated in my app as well. right now it is not update the name.

already tried the permissions of read and write contacts and profile permission as well. and good thing is it is working well in iOS and android older versions. issue came in new android versions like android version 10, 11,12 and 13

vrinsoft
  • 1
  • 1

1 Answers1

0

Welcome to StackOverflow!

As far as I know, there is no built-in method at present in React Native that can detect when a new contact is added in phone. Hence you will need to implement a custom native plugin of your own.

For Android, starting with API level 18, you can use Contacts.CONTACT_LAST_UPDATED_TIMESTAMP, so I guess it may be possible to query for all contacts that had been modified (or created) recently, and compare only those to your last cache of contact ids, and the delta would be the contacts created since the last time your application code ran.

Hope that helps!

inkredusk
  • 919
  • 4
  • 16