@ohos-ports/expo-network 57.0.2-beta.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +391 -0
  2. package/LICENSE +21 -0
  3. package/README.md +44 -0
  4. package/android/build.gradle +27 -0
  5. package/android/src/main/AndroidManifest.xml +4 -0
  6. package/android/src/main/java/expo/modules/network/NetworkExceptions.kt +9 -0
  7. package/android/src/main/java/expo/modules/network/NetworkModule.kt +281 -0
  8. package/android/src/main/java/expo/modules/network/NetworkUtils.kt +52 -0
  9. package/build/ExpoNetwork.d.ts +3 -0
  10. package/build/ExpoNetwork.d.ts.map +1 -0
  11. package/build/ExpoNetwork.js +3 -0
  12. package/build/ExpoNetwork.js.map +1 -0
  13. package/build/ExpoNetwork.web.d.ts +14 -0
  14. package/build/ExpoNetwork.web.d.ts.map +1 -0
  15. package/build/ExpoNetwork.web.js +47 -0
  16. package/build/ExpoNetwork.web.js.map +1 -0
  17. package/build/Network.d.ts +80 -0
  18. package/build/Network.d.ts.map +1 -0
  19. package/build/Network.js +111 -0
  20. package/build/Network.js.map +1 -0
  21. package/build/Network.types.d.ts +85 -0
  22. package/build/Network.types.d.ts.map +1 -0
  23. package/build/Network.types.js +55 -0
  24. package/build/Network.types.js.map +1 -0
  25. package/expo-module.config.json +15 -0
  26. package/ios/Exceptions.swift +7 -0
  27. package/ios/ExpoNetwork.podspec +28 -0
  28. package/ios/NetworkModule.swift +155 -0
  29. package/ios/NetworkType.swift +30 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2-sources.jar +0 -0
  31. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2-sources.jar.md5 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2-sources.jar.sha1 +1 -0
  33. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2-sources.jar.sha256 +1 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2-sources.jar.sha512 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.aar +0 -0
  36. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.aar.md5 +1 -0
  37. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.aar.sha1 +1 -0
  38. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.aar.sha256 +1 -0
  39. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.aar.sha512 +1 -0
  40. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.module +101 -0
  41. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.module.md5 +1 -0
  42. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.module.sha1 +1 -0
  43. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.module.sha256 +1 -0
  44. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.module.sha512 +1 -0
  45. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.pom +59 -0
  46. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.pom.md5 +1 -0
  47. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.pom.sha1 +1 -0
  48. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.pom.sha256 +1 -0
  49. package/local-maven-repo/host/exp/exponent/expo.modules.network/57.0.2/expo.modules.network-57.0.2.pom.sha512 +1 -0
  50. package/local-maven-repo/host/exp/exponent/expo.modules.network/maven-metadata.xml +13 -0
  51. package/local-maven-repo/host/exp/exponent/expo.modules.network/maven-metadata.xml.md5 +1 -0
  52. package/local-maven-repo/host/exp/exponent/expo.modules.network/maven-metadata.xml.sha1 +1 -0
  53. package/local-maven-repo/host/exp/exponent/expo.modules.network/maven-metadata.xml.sha256 +1 -0
  54. package/local-maven-repo/host/exp/exponent/expo.modules.network/maven-metadata.xml.sha512 +1 -0
  55. package/package.json +41 -0
  56. package/spm.config.json +37 -0
  57. package/src/ExpoNetwork.ts +3 -0
  58. package/src/ExpoNetwork.web.ts +52 -0
  59. package/src/Network.ts +123 -0
  60. package/src/Network.types.ts +90 -0
  61. package/tsconfig.json +10 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,391 @@
1
+ # Changelog
2
+
3
+ ## Unpublished
4
+
5
+ ### 🛠 Breaking changes
6
+
7
+ ### 🎉 New features
8
+
9
+ ### 🐛 Bug fixes
10
+
11
+ ### 💡 Others
12
+
13
+ ## 57.0.2 — 2026-09-11
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 57.0.1 — 2026-07-15
18
+
19
+ _This version does not introduce any user-facing changes._
20
+
21
+ ## 57.0.0 — 2026-06-25
22
+
23
+ _This version does not introduce any user-facing changes._
24
+
25
+ ## 56.0.5 — 2026-06-05
26
+
27
+ ### 🎉 New features
28
+
29
+ - [macOS] Add support for the macOS platform. ([#46535](https://github.com/expo/expo/pull/46535) by [@tsapeta](https://github.com/tsapeta))
30
+
31
+ ## 56.0.4 — 2026-05-19
32
+
33
+ _This version does not introduce any user-facing changes._
34
+
35
+ ## 56.0.3 — 2026-05-06
36
+
37
+ _This version does not introduce any user-facing changes._
38
+
39
+ ## 56.0.2 — 2026-05-06
40
+
41
+ _This version does not introduce any user-facing changes._
42
+
43
+ ## 56.0.1 — 2026-05-06
44
+
45
+ _This version does not introduce any user-facing changes._
46
+
47
+ ## 56.0.0 — 2026-05-05
48
+
49
+ ### 🛠 Breaking changes
50
+
51
+ - Bumped minimum iOS/tvOS version to 16.4, macOS to 13.4. ([#43296](https://github.com/expo/expo/pull/43296) by [@tsapeta](https://github.com/tsapeta))
52
+
53
+ ### 🐛 Bug fixes
54
+
55
+ - [Android] Fixed network state listener emitting a stale "connected" event when the device disconnects from the network on Android 13+. ([#44656](https://github.com/expo/expo/pull/44656) by [@gueroverdenwshq](https://github.com/gueroverdenwshq))
56
+ - [Android] Make `isInternetReachable` much more robust. Also emit network state changes when network capabilities change. ([#45101](https://github.com/expo/expo/pull/45101) by [@LumaDevelopment](https://github.com/LumaDevelopment))
57
+
58
+ ## 55.0.13 - 2026-04-09
59
+
60
+ _This version does not introduce any user-facing changes._
61
+
62
+ ## 55.0.12 - 2026-04-07
63
+
64
+ _This version does not introduce any user-facing changes._
65
+
66
+ ## 55.0.11 - 2026-04-02
67
+
68
+ _This version does not introduce any user-facing changes._
69
+
70
+ ## 55.0.10 - 2026-04-02
71
+
72
+ _This version does not introduce any user-facing changes._
73
+
74
+ ## 55.0.9 - 2026-03-17
75
+
76
+ _This version does not introduce any user-facing changes._
77
+
78
+ ## 55.0.8 — 2026-02-25
79
+
80
+ _This version does not introduce any user-facing changes._
81
+
82
+ ## 55.0.7 — 2026-02-20
83
+
84
+ _This version does not introduce any user-facing changes._
85
+
86
+ ## 55.0.6 — 2026-02-16
87
+
88
+ _This version does not introduce any user-facing changes._
89
+
90
+ ## 55.0.5 — 2026-02-08
91
+
92
+ _This version does not introduce any user-facing changes._
93
+
94
+ ## 55.0.4 — 2026-02-03
95
+
96
+ _This version does not introduce any user-facing changes._
97
+
98
+ ## 55.0.3 — 2026-01-27
99
+
100
+ _This version does not introduce any user-facing changes._
101
+
102
+ ## 55.0.2 — 2026-01-26
103
+
104
+ _This version does not introduce any user-facing changes._
105
+
106
+ ## 55.0.1 — 2026-01-22
107
+
108
+ _This version does not introduce any user-facing changes._
109
+
110
+ ## 55.0.0 — 2026-01-21
111
+
112
+ ### 🐛 Bug fixes
113
+
114
+ - [Android] Fix network state race condition by delaying callback ([#40705](https://github.com/expo/expo/pull/40705) by [@kosmydel](https://github.com/kosmydel))
115
+
116
+ ## 8.0.8 - 2025-12-05
117
+
118
+ _This version does not introduce any user-facing changes._
119
+
120
+ ## 8.0.7 — 2025-09-11
121
+
122
+ _This version does not introduce any user-facing changes._
123
+
124
+ ## 8.0.6 — 2025-09-02
125
+
126
+ _This version does not introduce any user-facing changes._
127
+
128
+ ## 8.0.5 — 2025-08-31
129
+
130
+ _This version does not introduce any user-facing changes._
131
+
132
+ ## 8.0.4 — 2025-08-27
133
+
134
+ _This version does not introduce any user-facing changes._
135
+
136
+ ## 8.0.3 — 2025-08-25
137
+
138
+ _This version does not introduce any user-facing changes._
139
+
140
+ ## 8.0.2 — 2025-08-16
141
+
142
+ _This version does not introduce any user-facing changes._
143
+
144
+ ## 8.0.1 — 2025-08-15
145
+
146
+ _This version does not introduce any user-facing changes._
147
+
148
+ ## 8.0.0 — 2025-08-13
149
+
150
+ _This version does not introduce any user-facing changes._
151
+
152
+ ## 7.1.5 — 2025-04-30
153
+
154
+ _This version does not introduce any user-facing changes._
155
+
156
+ ## 7.1.4 — 2025-04-25
157
+
158
+ _This version does not introduce any user-facing changes._
159
+
160
+ ## 7.1.3 — 2025-04-14
161
+
162
+ _This version does not introduce any user-facing changes._
163
+
164
+ ## 7.1.2 — 2025-04-11
165
+
166
+ _This version does not introduce any user-facing changes._
167
+
168
+ ## 7.1.1 — 2025-04-09
169
+
170
+ _This version does not introduce any user-facing changes._
171
+
172
+ ## 7.1.0 — 2025-04-04
173
+
174
+ ### 🐛 Bug fixes
175
+
176
+ - [Android] Added `netInfo` null check. ([#33559](https://github.com/expo/expo/pull/33559)) by [@pchalupa](https://github.com/pchalupa)
177
+
178
+ ### 💡 Others
179
+
180
+ - [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
181
+ - [apple] Migrate remaining `expo-module.config.json` to unified platform syntax. ([#34445](https://github.com/expo/expo/pull/34445) by [@reichhartd](https://github.com/reichhartd))
182
+ - [iOS] Fix warnings which will become errors in Swift 6. ([#35288](https://github.com/expo/expo/pull/35288) by [@behenate](https://github.com/behenate))
183
+
184
+ ## 7.0.5 - 2025-01-10
185
+
186
+ _This version does not introduce any user-facing changes._
187
+
188
+ ## 7.0.4 - 2024-12-16
189
+
190
+ ### 🐛 Bug fixes
191
+
192
+ - On `Android`, Prevent crash from the `networkCallback` calling `fetchNetworkState`. ([#33563](https://github.com/expo/expo/pull/33563) by [@alanjhughes](https://github.com/alanjhughes))
193
+
194
+ ## 7.0.3 - 2024-12-02
195
+
196
+ ### 🐛 Bug fixes
197
+
198
+ - Fix event emitters not working on web. ([#33327](https://github.com/expo/expo/pull/33327) by [@aleqsio](https://github.com/aleqsio))
199
+
200
+ ## 7.0.2 — 2024-11-22
201
+
202
+ _This version does not introduce any user-facing changes._
203
+
204
+ ## 7.0.1 — 2024-11-22
205
+
206
+ ### 🐛 Bug fixes
207
+
208
+ - [iOS] Added fix to getNetworkStateAsync failing on iOS ([#33137](https://github.com/expo/expo/pull/33137) by [@chrfalch](https://github.com/chrfalch))
209
+
210
+ ## 7.0.0 — 2024-10-22
211
+
212
+ ### 🛠 Breaking changes
213
+
214
+ - Bumped iOS and tvOS deployment target to 15.1. ([#30840](https://github.com/expo/expo/pull/30840) by [@tsapeta](https://github.com/tsapeta))
215
+
216
+ ### 🎉 New features
217
+
218
+ - Add network state change listeners ([#28808](https://github.com/expo/expo/pull/28808) by [@reichhartd](https://github.com/reichhartd))
219
+
220
+ ### 🐛 Bug fixes
221
+
222
+ - [Android] Fix `java.lang.IllegalArgumentException: NetworkCallback was not registered`. ([#30185](https://github.com/expo/expo/pull/30185) by [@lukmccall](https://github.com/lukmccall))
223
+ - [iOS] Fix wired ethernet connection being reported as unknown type. ([#30169](https://github.com/expo/expo/pull/30169) by [@Simek](https://github.com/Simek))
224
+ - [iOS] Fix getting IP address from wired ethernet connection interfaces. ([#31223](https://github.com/expo/expo/pull/31223) by [@matt-oakes](https://github.com/matt-oakes))
225
+ - Add missing `react` peer dependencies for isolated modules. ([#30477](https://github.com/expo/expo/pull/30477) by [@byCedric](https://github.com/byCedric))
226
+
227
+ ## 6.0.1 — 2024-04-23
228
+
229
+ _This version does not introduce any user-facing changes._
230
+
231
+ ## 6.0.0 — 2024-04-18
232
+
233
+ ### 🎉 New features
234
+
235
+ - Add Apple TV support. ([#27819](https://github.com/expo/expo/pull/27819) by [@douglowder](https://github.com/douglowder))
236
+
237
+ ### 💡 Others
238
+
239
+ - Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
240
+
241
+ ## 5.8.0 — 2023-11-14
242
+
243
+ ### 🛠 Breaking changes
244
+
245
+ - Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
246
+ - On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
247
+
248
+ ## 5.7.0 — 2023-10-17
249
+
250
+ ### 🛠 Breaking changes
251
+
252
+ - Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
253
+
254
+ ### 🎉 New features
255
+
256
+ - Add Node.js support. ([#24505](https://github.com/expo/expo/pull/24505) by [@EvanBacon](https://github.com/EvanBacon))
257
+
258
+ ### 💡 Others
259
+
260
+ - Remove deprecated `getMacAddressAsync` method. ([#24505](https://github.com/expo/expo/pull/24505) by [@EvanBacon](https://github.com/EvanBacon))
261
+
262
+ ## 5.6.0 — 2023-09-04
263
+
264
+ ### 🎉 New features
265
+
266
+ - Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
267
+
268
+ ## 5.5.0 — 2023-08-02
269
+
270
+ _This version does not introduce any user-facing changes._
271
+
272
+ ## 5.4.0 — 2023-06-21
273
+
274
+ ### 🐛 Bug fixes
275
+
276
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
277
+
278
+ ## 5.3.0 — 2023-05-08
279
+
280
+ _This version does not introduce any user-facing changes._
281
+
282
+ ## 5.2.1 — 2023-02-09
283
+
284
+ _This version does not introduce any user-facing changes._
285
+
286
+ ## 5.2.0 — 2023-02-03
287
+
288
+ ### 💡 Others
289
+
290
+ - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
291
+
292
+ ## 5.1.0 — 2022-12-30
293
+
294
+ ### 🎉 New features
295
+
296
+ - Migrated to Expo Modules API. ([#20083](https://github.com/expo/expo/pull/20083) and [#20303](https://github.com/expo/expo/pull/20303) by [@alanhughes](https://github.com/alanjhughes))
297
+
298
+ ## 5.0.0 — 2022-10-25
299
+
300
+ ### 🛠 Breaking changes
301
+
302
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
303
+
304
+ ## 4.3.0 — 2022-07-07
305
+
306
+ _This version does not introduce any user-facing changes._
307
+
308
+ ## 4.2.0 — 2022-04-18
309
+
310
+ ### ⚠️ Notices
311
+
312
+ - On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
313
+
314
+ ## 4.1.1 - 2022-02-01
315
+
316
+ ### 🐛 Bug fixes
317
+
318
+ - Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
319
+
320
+ ## 4.1.0 — 2021-12-03
321
+
322
+ _This version does not introduce any user-facing changes._
323
+
324
+ ## 4.0.1 — 2021-10-01
325
+
326
+ _This version does not introduce any user-facing changes._
327
+
328
+ ## 4.0.0 — 2021-09-28
329
+
330
+ ### 🛠 Breaking changes
331
+
332
+ - Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
333
+
334
+ ### 🐛 Bug fixes
335
+
336
+ - Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
337
+
338
+ ### 💡 Others
339
+
340
+ - Migrated from `@unimodules/core` to `expo-modules-core`. ([#13757](https://github.com/expo/expo/pull/13757) by [@tsapeta](https://github.com/tsapeta))
341
+ - Rewrite Android code to Kotlin. ([#14474](https://github.com/expo/expo/pull/14474) by [@kkafar](https://github.com/kkafar))
342
+
343
+ ## 3.2.0 — 2021-06-16
344
+
345
+ ### 🐛 Bug fixes
346
+
347
+ - Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
348
+
349
+ ### 💡 Others
350
+
351
+ - Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo))
352
+
353
+ ## 3.1.1 — 2021-03-30
354
+
355
+ _This version does not introduce any user-facing changes._
356
+
357
+ ## 3.1.0 — 2021-03-10
358
+
359
+ ### 🎉 New features
360
+
361
+ - Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
362
+
363
+ ### 🐛 Bug fixes
364
+
365
+ - Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
366
+
367
+ ## 3.0.0 — 2021-01-15
368
+
369
+ ### 🛠 Breaking changes
370
+
371
+ - Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta))
372
+
373
+ ### 🐛 Bug fixes
374
+
375
+ - Fixed issue on Android where apps would crash when calling `getIpAddressAsync` when using cellular data or on certain IP addresses.
376
+
377
+ ## 2.4.0 — 2020-11-17
378
+
379
+ _This version does not introduce any user-facing changes._
380
+
381
+ ## 2.3.0 — 2020-08-18
382
+
383
+ _This version does not introduce any user-facing changes._
384
+
385
+ ## 2.2.1 — 2020-05-29
386
+
387
+ _This version does not introduce any user-facing changes._
388
+
389
+ ## 2.2.0 — 2020-05-27
390
+
391
+ _This version does not introduce any user-facing changes._
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ <p>
2
+ <a href="https://docs.expo.dev/versions/latest/sdk/network/">
3
+ <img
4
+ src="../../.github/resources/expo-network.svg"
5
+ alt="expo-network"
6
+ height="64" />
7
+ </a>
8
+ </p>
9
+ Gets device's network information such as ip address, mac address and check for airplane mode.
10
+
11
+ See [Expo Network docs](https://docs.expo.dev/versions/latest/sdk/network/) for documentation of this universal module's API.
12
+
13
+ # API documentation
14
+
15
+ - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/network/)
16
+ - [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/network/)
17
+
18
+ # Installation in managed Expo projects
19
+
20
+ For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/network/).
21
+
22
+ # Installation in bare React Native projects
23
+
24
+ For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
25
+
26
+ ### Add the package to your npm dependencies
27
+
28
+ ```
29
+ npx expo install expo-network
30
+ ```
31
+
32
+ ### Configure for Android
33
+
34
+ This module requires permissions to access the network and Wi-Fi state. The `ACCESS_NETWORK_STATE` and `ACCESS_WIFI_STATE` permissions are added automatically.
35
+
36
+ ```xml
37
+ <!-- Added permissions -->
38
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
39
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
40
+ ```
41
+
42
+ # Contributing
43
+
44
+ Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
@@ -0,0 +1,27 @@
1
+ plugins {
2
+ id 'com.android.library'
3
+ id 'expo-module-gradle-plugin'
4
+ }
5
+
6
+ group = 'host.exp.exponent'
7
+ version = '57.0.2'
8
+
9
+ android {
10
+ namespace "expo.modules.network"
11
+ defaultConfig {
12
+ versionCode 11
13
+ versionName '57.0.2'
14
+ }
15
+
16
+ testOptions {
17
+ unitTests.includeAndroidResources = true
18
+ }
19
+ }
20
+
21
+ dependencies {
22
+ if (project.findProject(':expo-modules-test-core')) {
23
+ testImplementation project(':expo-modules-test-core')
24
+ }
25
+ testImplementation 'io.mockk:mockk:1.14.9'
26
+ testImplementation "org.robolectric:robolectric:4.16.1"
27
+ }
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
3
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
4
+ </manifest>
@@ -0,0 +1,9 @@
1
+ package expo.modules.network
2
+
3
+ import expo.modules.kotlin.exception.CodedException
4
+
5
+ internal class NetworkAccessException(e: Exception) :
6
+ CodedException("Unable to access network information", e.cause)
7
+
8
+ internal class NetworkWifiException(e: Exception) :
9
+ CodedException("Wi-Fi information could not be acquired", e.cause)