@icedevml/react-native-host-card-emulation 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,11 +117,11 @@ Afterwards, follow the subsections below for each platform that you need to supp
|
|
|
117
117
|
This module provides a uniform low-level HCE API for both mobile platforms.
|
|
118
118
|
|
|
119
119
|
> [!NOTE]
|
|
120
|
-
> Raw native module's API specification is available in [packages/host-card-emulation/js](https://github.com/icedevml/react-native-host-card-emulation/
|
|
120
|
+
> Raw native module's API specification is available in [packages/host-card-emulation/js](https://github.com/icedevml/react-native-host-card-emulation/tree/master/packages/host-card-emulation/js) subdirectory.
|
|
121
121
|
> Check it out in order to understand what methods you can call against the module and what are the expected parameters/return values.
|
|
122
122
|
|
|
123
123
|
> [!NOTE]
|
|
124
|
-
> See [Demo
|
|
124
|
+
> See [Source Code for Demo Application: NDEF NFC Type 4 Tag Emulator (for iOS/Android)](https://github.com/icedevml/react-native-host-card-emulation/tree/master/packages/demo-ndef-app) example for more insignt about the library's API.
|
|
125
125
|
|
|
126
126
|
### Quick start guide
|
|
127
127
|
|
|
@@ -200,12 +200,29 @@ This function will throw an exception if:
|
|
|
200
200
|
* you are in the cooldown period where you are not allowed to acquire the presentment intent assertion (cooldown is 15 seconds after the previous assertion had expired);
|
|
201
201
|
* the feature is not supported or the device is not eligible for whatever reason;
|
|
202
202
|
|
|
203
|
+
You can check if you are holding an exclusive NFC access by calling:
|
|
204
|
+
```typescript
|
|
205
|
+
NativeHCEModule.isExclusiveNFC()
|
|
206
|
+
```
|
|
207
|
+
|
|
203
208
|
Whenever you don't need the exclusive NFC access anymore, call the following function to release the `NFCPresentmentIntentAssertion` object:
|
|
204
209
|
```typescript
|
|
205
|
-
|
|
210
|
+
NativeHCEModule.releaseExclusiveNFC();
|
|
206
211
|
```
|
|
207
212
|
|
|
208
|
-
|
|
213
|
+
> [!TIP]
|
|
214
|
+
> Your exclusive NFC access might time out after exceeding certain allowance period imposed by iOS. Thus, you should periodically poll
|
|
215
|
+
> the `NativeHCEModule.isExclusiveNFC()` value to see if it's still granted. You might decide to navigate into a different UI view
|
|
216
|
+
> once your assertion has timed out, or indicate that in some different way.
|
|
217
|
+
|
|
218
|
+
> [!TIP]
|
|
219
|
+
> Use the React's [AppState](https://reactnative.dev/docs/appstate) listener to see when your app goes out to background.
|
|
220
|
+
> In such event, call `NativeHCEModule.releaseExclusiveNFC()` to explicitly release the exclusive NFC assertion.
|
|
221
|
+
>
|
|
222
|
+
> You must do so in order to avoid running into ambigous states, since the operating system is not going to enforce your
|
|
223
|
+
> exclusive NFC access anyway, as your app has gone to background.
|
|
224
|
+
>
|
|
225
|
+
> You can attempt to acquire the exclusive access assertion again once your app has gone back to foreground (active state).
|
|
209
226
|
|
|
210
227
|
### Android: Handle HCE calls when the app is not running
|
|
211
228
|
|
|
@@ -261,5 +278,5 @@ for instance - your app may emulate an NDEF tag even when it's not launched on t
|
|
|
261
278
|
|
|
262
279
|
### More resources
|
|
263
280
|
|
|
264
|
-
* [Module's API specification](https://github.com/icedevml/react-native-host-card-emulation/
|
|
265
|
-
* [Demo
|
|
281
|
+
* [Module's API specification](https://github.com/icedevml/react-native-host-card-emulation/tree/master/packages/host-card-emulation/js)
|
|
282
|
+
* [Source Code for Demo Application: NDEF NFC Type 4 Tag Emulator (for iOS/Android)](https://github.com/icedevml/react-native-host-card-emulation/tree/master/packages/demo-ndef-app)
|
package/package.json
CHANGED