Menu

React Native Integration Guide (Android)


  • Follow the steps in Part I of our General Integration Guide.
  • In android code, include files DyScanPackage.java, DyScanView.java, InitDyScanActivity.java (also provided by us). You will need to rename “package com.testingdocs;” that appears at the top of these java files
  • In the AndroidManifest.xml file add the following permissions:
    
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />
    
    
  • In the AndroidManifest.xml file, include the activity
    
    <activity android:name=".InitDyScanActivity"/> 
    
  • In the MainApplication.java file, adjust the getPackages() function to include the DyScanPackage()
    
    @Override
    protected List<ReactPackage/> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new RNGestureHandlerPackage(),
            new DyScanPackage()
          );
    }
    

In React

Include the following in your App.js file


import { NativeModules } from 'react-native';

const { DyScanReact } = NativeModules;

The DyScanReact class can then be used to show DyScan to your users. In particular, the DyScanReact.pay() method will display the scanner.

Get Started