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 1010import android .os .Build ;
1111import androidx .annotation .NonNull ;
1212import android .net .Network ;
13+ import android .net .NetworkInfo ;
1314import android .net .NetworkCapabilities ;
1415import android .net .ConnectivityManager ;
1516import android .util .Base64 ;
@@ -246,14 +247,15 @@ else if(this.options.fileCache)
246247 Network [] networks = connectivityManager .getAllNetworks ();
247248
248249 for (Network network : networks ) {
249- //NetworkInfo netInfo = connectivityManager.getNetworkInfo(network);
250+
251+ NetworkInfo netInfo = connectivityManager .getNetworkInfo (network );
250252 NetworkCapabilities caps = connectivityManager .getNetworkCapabilities (network );
251- if (caps == null ){
253+
254+ if (caps == null || netInfo == null ){
252255 continue ;
253256 }
254257
255- // Don't use P2P Wi-Fi on recent samsung devices
256- if (caps .hasTransport (NetworkCapabilities .NET_CAPABILITY_WIFI_P2P )){
258+ if (!netInfo .isConnected ()){
257259 continue ;
258260 }
259261
You can’t perform that action at this time.
0 commit comments