Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit 83fd890

Browse files
authored
Update README.md
1 parent 9a28451 commit 83fd890

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,21 @@ Measure the round-trip time (RTT) by using ICMP echo request packets to the inte
55

66
🚀 This library is supported in New Architecture (Turbo Modules)
77

8+
## Requirements
9+
10+
This library requires explicit library and React Native version due to Turbo Modules capabilities
11+
12+
#### New Architecture
13+
- For React Native >= 0.76, use `react-native-ping-android` version 2.x or latest
14+
- For React Native >= 0.72, use `react-native-ping-android` version 1.3.0
15+
#### Old Architecture
16+
It's marked for React Native >= 0.72 and your app can use the 2.x or latest version of this library.
17+
Cannot guarantee for older React Native versions support. It requires some tests.
18+
19+
About compatibility [here](#compatibility)
20+
821
## Installation
9-
#### - For React Native >= 0.76
22+
#### Version 2.x or latest
1023
npm
1124
```
1225
npm install react-native-ping-android
@@ -16,7 +29,7 @@ or with Yarn
1629
```
1730
yarn add react-native-ping-android
1831
```
19-
#### - For React Native >= 0.72
32+
#### Version 1.3.0
2033
npm
2134
```
2235
npm install react-native-ping-android@1.3.0
@@ -246,6 +259,11 @@ It extends [ICMPConstructorData](#icmpconstructordata).
246259
| `UNKNOWN_FAILURE` | `-3` |
247260
#
248261

262+
## Compatibility
263+
In the latest version, this library is using the event listener technique that performs much better rather than the resovable promise like the previous one, but he drawback is the React Native compatibility. While the new version performs better, it requires new React Native version for the New Architecture, since the [event listener (Event Emitting) capabilities](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/turbo-modules.md#add-event-emitting-capabilities) only support for React Native >= 0.76 in New Architecture, but support for React Native >= 0.72 in Old Architecture. Cannot guarantee for older React Native versions support. It requires some tests.
264+
265+
Better to use 2.x version, simply because it performs much better. It's because the counter and the interval logic with the `setInterval` JavaScript are moved to the Kotlin side. In Kotlin side, it will reuses the instantiated Kotlin Coroutines until it's no longer needed, and emit the ping result to your event callback without blocking the JS thread at all. Not like the 1.x version that use resovable promise the ping result, create and destroy the Coroutines immediately when the promise has resolvabled, and repeat the process in JavaScript side with `setInterval`.
266+
249267
## Android Emulator Limitations
250268
Depending on the environment, the emulator might not be able to support other protocols (such as ICMP, used for "ping"). See [Local networking limitations](https://developer.android.com/studio/run/emulator-networking#networkinglimitations).
251269

0 commit comments

Comments
 (0)