Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update The Installation Steps of Android #6

Open
tejas77 opened this issue Sep 29, 2018 · 0 comments
Open

Update The Installation Steps of Android #6

tejas77 opened this issue Sep 29, 2018 · 0 comments

Comments

@tejas77
Copy link

tejas77 commented Sep 29, 2018

Installation

$ npm install git+https://git@github.com/aseemnishad/react-native-android-scanner.git --save

  • In android/setting.gradle
...
include ':react-native-android-scanner'
project(':react-native-android-scanner').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-scanner/android')

include ':scanlibrary'
project(':scanlibrary').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-scanner/android/scanlibrary')
  • In android/app/build.gradle
    //New Updates :
...
dependencies {
    ...
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation project(':react-native-android-scanner')
    implementation project(':scanlibrary')
}
  • Add the required permissions in AndroidManifest.xml:

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    ...
    
    <application
      android:allowBackup="true"
  • Change the required in MainActivity.java`:

    from
    import com.scanlibrary.RNReactNativeAndroidScannerPackage;
    to 
    import com.reactlibrary.RNReactNativeAndroidScannerPackage;

Add to an Activity

Open your activity, usually located in android/app/src/main/java/[your package]/MainApplication.java.
Add import com.reactlibrary.RNReactNativeAndroidScannerPackage; to the imports at the top of the file.
Add new RNReactNativeAndroidScannerPackage() to the list returned by the getPackages() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant