You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,21 @@ Measure the round-trip time (RTT) by using ICMP echo request packets to the inte
5
5
6
6
🚀 This library is supported in New Architecture (Turbo Modules)
7
7
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
+
8
21
## Installation
9
-
#### - For React Native >= 0.76
22
+
#### Version 2.x or latest
10
23
npm
11
24
```
12
25
npm install react-native-ping-android
@@ -16,7 +29,7 @@ or with Yarn
16
29
```
17
30
yarn add react-native-ping-android
18
31
```
19
-
#### - For React Native >= 0.72
32
+
#### Version 1.3.0
20
33
npm
21
34
```
22
35
npm install react-native-ping-android@1.3.0
@@ -246,6 +259,11 @@ It extends [ICMPConstructorData](#icmpconstructordata).
246
259
|`UNKNOWN_FAILURE`|`-3`|
247
260
#
248
261
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
+
249
267
## Android Emulator Limitations
250
268
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).
0 commit comments