Giter Club home page Giter Club logo

doordeck-sdk-react-native's Introduction

Doordeck React Native SDK

Prerequisites

CocaoPods

$ sudo gem install cocoapods

Getting started

  1. Install via npm

    $ npm install @doordeck/react-native-doordeck-sdk --save

  2. Link react-native files

    $ react-native link @doordeck/react-native-doordeck-sdk

Mostly automatic installation

Coming soon - see manual install for now

Manual installation

iOS

  1. Open your .xcworkspace file in your /ios folder. If you do not have a .xcworkspace, open the .xcodeproj file.

  2. In XCode, in the project navigator, right click [your project's name folder]Add Files to [your project's name].

  3. Go to one folder up and navigate to node_modules/@doordeck/react-native-doordeck-sdk/ios and add folder doordeck-sdk.

  4. In XCode, in the project navigator, select your project. Set your Swift Language Version to Swift 5 in your project's Build SettingsSwift Language Version.

  5. Add pod dependencies: Navigate in a terminal to your [your react native project's folder]/ios. If there isn't a podfile you need to set it up by running $ pod init. Edit the podfile and add the following lines under # Pods for [your project's name]:

     platform :ios, "10.0"
     pod "QRCodeReader.swift", "~> 10.0"
     pod "ReachabilitySwift", "~> 4.3"
     pod "Alamofire", "~> 4.8"
     pod "Cache", "~> 5.2"
     pod "Sodium", "~> 0.8"
    

    In terminal run $ pod install

  6. Add permissions: Add the following to your project plist.

     “Privacy - Camera Usage Description” -> “NSCameraUsageDescription”
     “Privacy - NFC Scan Usage Description” -> “NFCReaderUsageDescription”
     “Privacy - Location When In Use Usage Description” -> “NSLocationAlwaysAndWhenInUseUsageDescription”
    

    To use NFC, turn it on in your project target settings CapablitiesNear Field Communication Tag Reading

  7. To run your project, open the .xcworkspace file (not the .xcodeproj file) in your /ios folder and press run (Cmd+R).

Android

  1. Edit your app gradle file:

     minSdkVersion 21
     android {
     	packagingOptions {
     		pickFirst("META-INF/atomicfu.kotlin_module")
     	}
     }
     repositories {
     	maven { url "https://jitpack.io" }
     }
    
  2. Add following to your gradle.properties

     android.useAndroidX=true
     android.enableJetifier=true
    
  3. To run your app, type $ react-native run-android

Usage

import doordeckSdk from '@doordeck/react-native-doordeck-sdk';

// Initialise the SDK with your AuthToken
doordeckSdk.initDoordeck(authToken)

// Show unlock screen (NFC/QR reader)
doordeckSdk.showUnlock()

doordeck-sdk-react-native's People

Contributors

greglovescoding avatar

Watchers

 avatar

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.