1.0.7 • Published 6 years ago

react-native-smartlock v1.0.7

Weekly downloads
32
License
-
Repository
-
Last release
6 years ago

react-native-smartlock

A simple wrapper for Smart Lock authentication of Google for React Native. Only for Android.

#Installation

$ npm install react-native-smartlock --save

Android

android/app/build.gradle

Add the project to your dependencies

dependencies {
...
compile project(':react-native-smartlock')
}
android/settings.gradle

Add the project

include ':react-native-smartlock'
project(':react-native-smartlock').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-smartlock/android')
MainApplication.java

Add:

  1. import com.google.smartlock.smartlockrn.SmartLockPackager;

  2. In the getPackages() method register the module: new SmartLockPackager(MainApplication.this)

So getPackages() should look like:

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new SmartLockPackager(MainApplication.this),
    //.....
  );
}

Usage

import smartLock from 'react-native-smartlock';
smartLock.getCredentials()
  .then(credentials => {
      console.log(credentials);
      // user has permissions
  })
  .catch(err => {
      console.log(err);
      // user doesn't have permissions or cancelled login
  });
1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago