Giter Site home page Giter Site logo

react-native-smartlock's Introduction

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/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
  });

react-native-smartlock's People

Contributors

maggialejandro avatar mloisotto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-native-smartlock's Issues

SmartLockPackager cannot be applied to given types

I can´t run the application

Missing argument in PackageList.java generated file

android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:59: error: constructor SmartLockPackager in class SmartLockPackager cannot be applied to given types;
      new SmartLockPackager(),
      ^
  required: Application
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error

How to save credentials in smartlock?

Would you please let me know how to save credentials through smartlock library.
In readme file, we have seen only get credentials method.

Thanks 👍

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.