# react-native-honeywell-barcode-reader

> A barcode reader for Honeywell handheld devices like Honeywell EDA50K (tested)

Latest version **1.0.6** (published 2018-12-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-honeywell-barcode-reader
pnpm add react-native-honeywell-barcode-reader
yarn add react-native-honeywell-barcode-reader
bun add react-native-honeywell-barcode-reader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2018-12-25 |
| First published | 2018-12-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0 |
| Dependencies | 0 |
| Unpacked size | 115.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Duy Tran |
| Maintainers | duytq94 |
| Keywords | honeywell, barcode, reader |

## Links

- npm: https://www.npmjs.com/package/react-native-honeywell-barcode-reader
- Repository: https://github.com/duytq94/react-native-honeywell-barcode-reader
- Homepage: https://github.com/duytq94/react-native-honeywell-barcode-reader#readme
- Issues: https://github.com/duytq94/react-native-honeywell-barcode-reader/issues
- npm.io page: https://npm.io/package/react-native-honeywell-barcode-reader

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2018-12-25
- 1.0.5 — 2018-12-25
- 1.0.4 — 2018-12-25
- 1.0.3 — 2018-12-25
- 1.0.2 — 2018-12-25
- 1.0.1 — 2018-12-25
- 1.0.0 — 2018-12-25

## README

# React Native Honeywell Barcode Reader

This package works with Honeywell devices that have an integrated barcode scanner, like the Honeywell EDA50K (tested).

Actually, I custom from https://github.com/Volst/react-native-honeywell-scanner but fix cannot remove event listener (even you close the reader). And if you don't remove, the event will fire twice, triple... more and more times when you call `addListener` until you kill the app.

The bug at here is you can not remove event listener by call `DeviceEventEmitter.removeListener(eventName, handler)` since it doesn't have this method. Follow here: https://stackoverflow.com/questions/36886628/how-do-you-remove-a-listener-from-react-natives-eventemitter-instance

## Installation

```
npm i react-native-honeywell-barcode-reader
```

## Link automatically:

```
react-native link react-native-honeywell-barcode-reader
```

## Link manually (recommend):

1. In `app\build.gradle` add
```
compile project(':react-native-honeywell-barcode-reader')
```

2. In `settings.gradle` add

```
include ':react-native-honeywell-barcode-reader'
project(':react-native-honeywell-barcode-reader').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-honeywell-barcode-reader/android')
```

3. In `MainApplication.java`

Add this line to import package
```
import com.duytq94.HoneywellBarcodeReader.HoneywellBarcodeReaderPackage;
```
and add this line to getPackages()
```
new HoneywellBarcodeReaderPackage()
```

## Usage

First you'll want to check whether the device is a Honeywell scanner:

```js
import HoneywellBarcodeReader from 'react-native-honeywell-barcode-reader';

HoneywellBarcodeReader.isCompatible // true or false
```

The barcode reader needs to be "claimed" by your application; meanwhile no other application can use it. You can do that like this:

```js
HoneywellBarcodeReader.startReader().then((claimed) => {
    console.log(claimed ? 'Barcode reader is claimed' : 'Barcode reader is busy');
});
```

To get events from the barcode scanner:

```js
HoneywellBarcodeReader.onBarcodeReadSuccess(event => {
    console.log('Received data', event);
});

HoneywellBarcodeReader.onBarcodeReadFail(() => {
    console.log('Barcode read failed');
});
```

To free the claim and stop the reader, also freeing up resources:

```js
HoneywellBarcodeReader.stopReader().then(() => {
    console.log('Freedom!');
});
```

To stop receiving events:

```js
HoneywellBarcodeReader.offBarcodeReadSuccess();
HoneywellBarcodeReader.offBarcodeReadFail();
```

---
_Source: https://npm.io/package/react-native-honeywell-barcode-reader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
