@cashlift_payments/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Support

version react-native version Xcode version
3.0.0+ 0.63.0+ 12+

Installing dependencies into a bare React Native project​

$ npm install --save react-native-ble-plx react-native-permissions
# --- or ---
$ yarn add react-native-ble-plx react-native-permissions

Setup

$ npm install --save @diviven/payment
# --- or ---
$ yarn add @diviven/payment

Configuration & Installation

Expo

  1. Make sure your Expo project is ejected (formerly: detached). You can read how to do it here and here. (only for expo)
  2. Follow steps for iOS/Android.

iOS (example setup)

  1. npm install --save react-native-ble-plx
  2. Enter ios folder and run pod update
  3. Add NSBluetoothAlwaysUsageDescription in info.plist file. (it is a requirement since iOS 13)
  4. 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.

Android (example setup)

  1. npm install --save react-native-ble-plx

  2. In top level build.gradle make sure that min SDK version is at least 18:

    buildscript {
        ext {
            ...
            minSdkVersion = 21
            ...
  3. In build.gradle make sure to add jitpack repository to known repositories:

    allprojects {
        repositories {
          ...
          maven { url 'https://www.jitpack.io' }
        }
    }
  4. (Optional) In AndroidManifest.xml, add Bluetooth permissions and update <uses-sdk/>:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        ...
        <uses-permission android:name="android.permission.BLUETOOTH"/>
        <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
        <uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/>
    
        <!-- Add this line if your application always requires BLE. More info can be found on:
            https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#permissions
          -->
        <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
    
        ...

Troubleshooting

Problems with Proguard

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

iOS

Add this line to your ios/Podfile file, then run pod install.

target 'YourAwesomeProject' do
  #
  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
end

Android

  1. Add the following lines to android/settings.gradle:
include ':react-native-permissions'
project(':react-native-permissions').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-permissions/android')
  1. Add the implementation line to the dependencies in android/app/build.gradle:
dependencies {
  // ...
  implementation project(':react-native-permissions')
}

How TO use

import {CheckPermissions, StartScanDevices} from '@diviven/payment'
...
CheckPermissions().then(()=>{
    StartScanDevices()
      .then(devices => {
        console.log(devices);
      })
      .catch(err => {
        console.log(err);
      });
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @cashlift_payments/sdk

Weekly Downloads

0

Version

0.0.6

License

ISC

Unpacked Size

11.3 kB

Total Files

10

Last publish

Collaborators

  • diviven
  • cashlift