<commit_before>## API
This library provide a default export `NfcManager` and 3 named exports `Ndef`, `NfcTech` and `ByteParser`, like this:
```javascript
import NfcManager, {Ndef, NfcTech, ByteParser} from 'react-native-nfc-manager'
```

All methods in `NfcManager` return a `Promise` object and are resolved to different types of data according to individual API.

* `Ndef` is an utility module to encode and decode some well-known NDEF format.
* `ByteParser` is an utility module to encode and decode byte[] arrays (used in Mifare Classic technology).
* `NfcTech` contains predefined constants for specific NFC technologies, which include `NfcA`, `NfcB`, `NfcF`, `NfcV`, `IsoDep`, `MifareClassic` and `MifareUltralight`.
    * These constants should be used with `requestTechnology` (Android Only) to obtain a NFC technology handle, and use it to perform technology specific operations.

The API documentation is grouped into 6 parts:

* [NfcManager API](##NfcManager-API)
* [Ndef API](##Ndef-API)
* [NfcTech.Ndef API](##NfcTech.Ndef-[Android-only])
* [Generic NfcTech API](##Generic-NfcTech-API-[Android-only])
* [NfcTech.MifareClassic API](##NfcTech.MifareClassic-API-[Android-only])
* [NfcTech.MifareUltralight API](##NfcTech.MifareUltralight-API-[Android-only])
* [ByteParser API](##ByteParser-API)

## NfcManager API

### start({onSessionClosedIOS})
Init the module. If the device doesn't support NFC, the returning promise will be rejected.

__Arguments__
- `onSessionClosedIOS` - `function` - [iOS only] the callback to invoke when an `NFCNDEFReaderSession` becomes invalidated

__Examples__
```js
NfcManager.start({
    onSessionClosedIOS: () => {
        console.log('ios session closed');
    }
})
    .then(result => {
        console.log('start OK', result);
    })
    .catch(error => {
        console.warn('device does not support nfc!');
        this.setState({supported: false});
    })
```

### stop()
Terminates the module. This will remove the onSessionClosedIOS listener that is attached in the `start` function.

### isSupported(tech = '')
Check if NFC (and specified NFC technology) is supported by the hardware.
When you specify a technology, some extra checks are performed to see if the technology is supported or not.
Returnes `Promise` resolved to a boolean value to indicate whether NFC (and specified NFC technology) is supported.

__Arguments__
- `tech` - `string` - optional parameter, use a constant of the NfcTech class, defaults to ''

__Examples__
```js
NfcManager.isSupported(NfcTech.MifareClassic)
    .then(() => console.log('Mifare classic is supported'))
    .catch(err => console.warn(err))
```


### isEnabled() [Android only]
Check if the NFC is enabled.
Returned `Promise` resolved to a boolean value to indicate whether NFC is enabled.

### goToNfcSetting() [Android only]
Direct the user to NFC setting.

### getLaunchTagEvent() [Android only]
Get the NFC tag object which launches the app.
Returned `Promise` resolved to the NFC tag object launching the app and resolved to null if the app isn't launched by NFC tag.

### registerTagEvent(listener, alertMessage, invalidateAfterFirstRead)
Start to listen to *ANY* NFC tags.
<commit_msg>Update APIv1.md<commit_after>## API
This library provide a default export `NfcManager` and 3 named exports `Ndef`, `NfcTech` and `ByteParser`, like this:
```javascript
import NfcManager, {Ndef, NfcTech, ByteParser} from 'react-native-nfc-manager'
```

All methods in `NfcManager` return a `Promise` object and are resolved to different types of data according to individual API.

* `Ndef` is an utility module to encode and decode some well-known NDEF format.
* `ByteParser` is an utility module to encode and decode byte[] arrays (used in Mifare Classic technology).
* `NfcTech` contains predefined constants for specific NFC technologies, which include `NfcA`, `NfcB`, `NfcF`, `NfcV`, `IsoDep`, `MifareClassic` and `MifareUltralight`.
    * These constants should be used with `requestTechnology` (Android Only) to obtain a NFC technology handle, and use it to perform technology specific operations.

The API documentation is grouped into 6 parts:

* [NfcManager API](##NfcManager-API)
* [Ndef API](##Ndef-API)
* [NfcTech.Ndef API](##NfcTech.Ndef-[Android-only])
* [Generic NfcTech API](##Generic-NfcTech-API-[Android-only])
* [NfcTech.MifareClassic API](##NfcTech.MifareClassic-API-[Android-only])
* [NfcTech.MifareUltralight API](##NfcTech.MifareUltralight-API-[Android-only])
* [ByteParser API](##ByteParser-API)

## NfcManager API

### start({onSessionClosedIOS})
Init the module. If the device doesn't support NFC, the returning promise will be rejected.

__Arguments__
- `onSessionClosedIOS` - `function` - [iOS only] the callback to invoke when an `NFCNDEFReaderSession` becomes invalidated

__Examples__
```js
NfcManager.start({
    onSessionClosedIOS: () => {
        console.log('ios session closed');
    }
})
    .then(result => {
        console.log('start OK', result);
    })
    .catch(error => {
        console.warn('device does not support nfc!');
        this.setState({supported: false});
    })
```

### stop()
Terminates the module. This will remove the onSessionClosedIOS listener that is attached in the `start` function.

### isSupported(tech = '')
Check if NFC (and specified NFC technology) is supported by the hardware.
When you specify a technology, some extra checks are performed to see if the technology is supported or not.
Returnes `Promise` resolved to a boolean value to indicate whether NFC (and specified NFC technology) is supported.

__Arguments__
- `tech` - `string` - optional parameter, use a constant of the NfcTech class, defaults to ''

__Examples__
```js
NfcManager.isSupported(NfcTech.MifareClassic)
    .then(() => console.log('Mifare classic is supported'))
    .catch(err => console.warn(err))
```


### isEnabled() [Android only]
Check if the NFC is enabled.
Returned `Promise` resolved to a boolean value to indicate whether NFC is enabled.

### goToNfcSetting() [Android only]
Direct the user to NFC setting.

### getLaunchTagEvent() [Android only]
Get the NFC tag object which launches the app.
Returned `Promise` resolved to the NFC tag object launching the app and resolved to null if the app isn't launched by NFC tag.

To launch your app with a tag you need to add an intent-filter to your manifest file, see example below. This filter must be set for your main activity, where you also call getLaunchTagEvent(). 
If you write text content to your tag the ndef message you filter for needs to be the first entry, otherwise if your intent-filter doesnt match the first record your `Promise` will resolve to null ([#208](https://github.com/whitedogg13/react-native-nfc-manager/issues/208)). 

```
<intent-filter>
  <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain" />
</intent-filter>
```

Another good point is to add `android:launchMode="singleTask"` to your manifest activity. Otherwise, if your app is already running your tag will start another instance and could lead to strange behavior (thanks [@levelpic](https://github.com/levepic)). 

### registerTagEvent(listener, alertMessage, invalidateAfterFirstRead)
Start to listen to *ANY* NFC tags.

{'fraction_non_alphanumeric': 0.10905856595511768, 'fraction_numerical': 0.0017788724685276409, 'mean_word_length': 4.8100158982511925, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 18, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4161745', 'n_tokens_mistral': 2218, 'n_tokens_neox': 2089, 'n_words': 825}