payment sdk
| version | react-native version | Xcode version |
| ------- | -------------------- | ------------- |
| 3.0.0+ | 0.63.0+ | 12+ |
bash
$ npm install --save react-native-ble-plx react-native-permissions
--- or ---
$ yarn add react-native-ble-plx react-native-permissions
`Setup
`bash
$ npm install --save @diviven/payment
--- or ---
$ yarn add @diviven/payment
`
Configuration & Installation
$3
1. Make sure your Expo project is ejected (formerly: detached). You can read how to do it here and here. (only for expo)
1. Follow steps for iOS/Android.
$3
1.
npm install --save react-native-ble-plx
1. Enter ios folder and run pod update
1. Add NSBluetoothAlwaysUsageDescription in info.plist file. (it is a requirement since iOS 13)
1. If you want to support background mode:
- In your application target go to Capabilities tab and enable Uses Bluetooth LE Accessories in
Background Modes section.
- Pass restoreStateIdentifier and restoreStateFunction to BleManager constructor.$3
1.
npm install --save react-native-ble-plx
1. In top level build.gradle make sure that min SDK version is at least 18:
`groovy
buildscript {
ext {
...
minSdkVersion = 21
...
`
1. In build.gradle make sure to add jitpack repository to known repositories:
`groovy
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
`
1. (Optional) In AndroidManifest.xml, add Bluetooth permissions and update :
`xml
...
...
`Troubleshooting
$3
Add this to your
app/proguard-rules.pro`
-dontwarn com.polidea.reactnativeble.**
`
🆘 Manual linking
Because this package targets React Native 0.63.0+, you probably won't need to link it manually. Otherwise if it's not the case, follow these additional instructions. You also need to manual link the module on Windows when using React Native Windows prior to 0.63:
👀 See manual linking instructions
$3
Add this line to your
ios/Podfile file, then run pod install.`bash
target 'YourAwesomeProject' do
# …
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
end
`$3
1. Add the following lines to
android/settings.gradle:`gradle
include ':react-native-permissions'
project(':react-native-permissions').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-permissions/android')
`2. Add the implementation line to the dependencies in
android/app/build.gradle:`gradle
dependencies {
// ...
implementation project(':react-native-permissions')
}
`How TO use
`jsx
import {CheckPermissions, StartScanDevices} from '@diviven/payment'
...
CheckPermissions().then(()=>{
StartScanDevices()
.then(devices => {
console.log(devices);
})
.catch(err => {
console.log(err);
});
});
``