Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by Ankit Abhinav for react-native-contacts getAll return null

Follow the steps mentioned in the documentation of react-native-contacts, and add a catch block at the end, it worked for me.

PermissionsAndroid.request(            PermissionsAndroid.PERMISSIONS.READ_CONTACTS,            {'title': 'Contacts','message': 'This app would like to view your contacts.'            }          ).then(() => {            con.getAll((err, contacts) => {              if (err === 'denied'){                // error              } else {                // contacts returned in Array                console.log(contacts);              }            })          })          .catch((err)=> {              console.log(err);          })

Viewing all articles
Browse latest Browse all 3

Trending Articles