1.1.3 • Published 8 years ago

react-native-contacts-android v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

react-native-contacts-android

receiving contact from the phonebook

Install

  • npm install react-native-contacts-android --save
  • In android/setting.gradle
    ...
    include ':react-native-contacts-android'
    project(':react-native-contacts-android').projectDir = new File(settingsDir, '../node_modules/react-native-contacts-android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-contacts-android')
}
import ru.getintime.react_native_contacts_android.ReactNativeSelectContactsPackage; // <------ add import

public class MainApplication extends Application implements ReactApplication  {

  @Override
    protected List<ReactPackage> getPackages() {
      ......
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          ......
          new ReactNativeSelectContactsPackage()
      );
    }
}
  • add Contacts permission (in android/app/src/main/AndroidManifest.xml)
...
  <uses-permission android:name="android.permission.READ_CONTACTS" />
...

Usage Example

import SelectContacts from 'react-native-contacts-android';

SelectContacts.picker((contact) => {

  ...

})

Contact

{
  "id": "2",
  "phones": [
    "id": "50",
    "number": "12344234"
  ]
}