$ npm install git+https://git@github.com/jose2007kj/accountManager.git --save
$ react-native link react-native-account-manager
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.jose2007kj.reactnative.RNAccountManagerPackage;
to the imports at the top of the file - Add
new RNAccountManagerPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-account-manager' project(':react-native-account-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-account-manager/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-account-manager')
- Insert the following permision in
android/src/app/main/androidmanifest.xml
:<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
import RNAccountManager from 'react-native-account-manager';
// TODO: What to do with the module? this print all account info like in this question https://stackoverflow.com/questions/13244130/how-to-list-out-all-the-accounts-facebook-twitter-gmail-etc-in-android
RNAccountManager.getAccounts().then(account => {
console.log('account info'+account.account);
})
.catch(error => {
console.log(error)
})