rn-android-nfc-serial-bridge
v1.13.0
Published
## Getting started
Downloads
3
Readme
rn-android-nfc-comm-bridge
Getting started
$ npm install react-native-android-nfc-comm-bridge --save
Mostly automatic installation
$ react-native link react-native-android-nfc-comm-bridge
Manual installation
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNAndroidNfcCommBridgePackage;
to the imports at the top of the file - Add
new RNAndroidNfcCommBridgePackage()
to the list returned by thegetPackages()
method
Append the following lines to
android/settings.gradle
:include ':react-native-android-nfc-comm-bridge' project(':react-native-android-nfc-comm-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-nfc-comm-bridge/android')
Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-android-nfc-comm-bridge')
Copy .so files under src/main/libs to target android
in MainActivity of your project
import android.view.KeyEvent; // <--- import import com.tickclass.reactlibrary.RNAndroidNfcCommBridgeModule;; // <--- import public class MainActivity extends ReactActivity { ...... @Override // <--- Add this method if you want to react to keyUp public boolean onKeyUp(int keyCode, KeyEvent event) { RNAndroidNfcCommBridgeModule.getInstance().onKeyUpEvent(keyCode, event); super.onKeyUp(keyCode, event); return true; }
Usage
import RNAndroidNfcCommBridge from 'react-native-android-nfc-comm-bridge';
// TODO: What to do with the module?
RNAndroidNfcCommBridge;