File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
android/src/main/java/com/RNFetchBlob Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 10
10
import android .os .Build ;
11
11
import androidx .annotation .NonNull ;
12
12
import android .net .Network ;
13
+ import android .net .NetworkInfo ;
13
14
import android .net .NetworkCapabilities ;
14
15
import android .net .ConnectivityManager ;
15
16
import android .util .Base64 ;
@@ -246,14 +247,15 @@ else if(this.options.fileCache)
246
247
Network [] networks = connectivityManager .getAllNetworks ();
247
248
248
249
for (Network network : networks ) {
249
- //NetworkInfo netInfo = connectivityManager.getNetworkInfo(network);
250
+
251
+ NetworkInfo netInfo = connectivityManager .getNetworkInfo (network );
250
252
NetworkCapabilities caps = connectivityManager .getNetworkCapabilities (network );
251
- if (caps == null ){
253
+
254
+ if (caps == null || netInfo == null ){
252
255
continue ;
253
256
}
254
257
255
- // Don't use P2P Wi-Fi on recent samsung devices
256
- if (caps .hasTransport (NetworkCapabilities .NET_CAPABILITY_WIFI_P2P )){
258
+ if (!netInfo .isConnected ()){
257
259
continue ;
258
260
}
259
261
You can’t perform that action at this time.
0 commit comments