1

On a React-Native mobile app, I need to access the contacts list, which is stored on the mobile device. The following 2 libraries provide this functionality. However, it seems that none of them provides information about which contacts have been updated (added/deleted/changed) recently.

Is there any library, which (1) provides some sort of notifications, which my app can subscribe to, to get updates about the contacts' list, or (2) provide a timestamp for when each contact was last updated?

I looked into the following libabries, but they do not seem to have this functionality.

  1. Expo Contacts (https://docs.expo.io/versions/v35.0.0/sdk/contacts/)
  2. React-Native-Contacts (https://github.com/rt2zz/react-native-contacts)

Your feedback is highly appreciated...

Bilal Abdeen
  • 1,627
  • 1
  • 19
  • 41

2 Answers2

0

I saw this in the Expo Contact library : Notifications Expo Contact

You just need to add listener, and after u can sort by categories :

Notifications.addListener(listener)

Notifications.createCategoryAsync(name: string, actions: ActionType[])

it return an EventSubscription object , u can remove notifications by :

EventSubscription.remove() 

Hope it will help,

If you need a easy way for notification, Firebase CLoud Messaging is the easiest way for configuring notification, and you can send global notification too by the firebase admin panel ,

Thomas Neveu
  • 116
  • 4
  • Thank you very much for the answer. However, Expo's Notification API does NOT seem to have anything to do with Contacts. I think it only provides the capability to listen to the app code (not the device services.) Am I missing something here? – Bilal Abdeen Oct 04 '19 at 09:14
  • Oh my bad, i think you store contact somewhere like api or DB, you cant have listener on device services ... If you really want to refresh the contact list, u need to store in local (with the library AsyncStorage) the last added contact when u use getAll(), and at the opening of the app u do a getAll() and compare the last contact to your last added contact. This is not the most optimizing way – Thomas Neveu Oct 04 '19 at 09:36
0

This is not currently possible. If you want this feature please request it in the issue tracker and we can deliberate.

The library would have to expose an event the javascript can register a listener for.

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116