CocaoPods
$ sudo gem install cocoapods
-
Install via npm
$ npm install @doordeck/react-native-doordeck-sdk --save
-
Link react-native files
$ react-native link @doordeck/react-native-doordeck-sdk
Coming soon - see manual install for now
-
Open your
.xcworkspace
file in your/ios
folder. If you do not have a .xcworkspace, open the.xcodeproj
file. -
In XCode, in the project navigator, right click
[your project's name folder]
➜Add Files to [your project's name]
. -
Go to one folder up and navigate to
node_modules/@doordeck/react-native-doordeck-sdk/ios
and add folderdoordeck-sdk
. -
In XCode, in the project navigator, select your project. Set your Swift Language Version to
Swift 5
in your project'sBuild Settings
➜Swift Language Version
. -
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
-
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
Capablities
➜Near Field Communication Tag Reading
-
To run your project, open the
.xcworkspace
file (not the .xcodeproj file) in your/ios
folder and press run (Cmd+R
).
-
Edit your app
gradle
file:minSdkVersion 21 android { packagingOptions { pickFirst("META-INF/atomicfu.kotlin_module") } } repositories { maven { url "https://jitpack.io" } }
-
Add following to your
gradle.properties
android.useAndroidX=true android.enableJetifier=true
-
To run your app, type
$ react-native run-android
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()