question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

reachability request not being called

See original GitHub issue

Environment

System:
    OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 9.73 GB / 31.28 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 10.19.0 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.4 - /usr/bin/npm
    Watchman: 4.9.0 - /usr/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 23, 25, 28, 29
      Build Tools: 28.0.3, 29.0.0, 29.0.2
      System Images: android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 1.8.0_252 - /usr/bin/javac
    Python: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

Platforms

  • Android

Versions

  • Android: 10
  • iOS: -
  • react-native-netinfo: 5.9.5
  • react-native: 0.62.2
  • react: 16.11.0

Description

I’m expecting useNetInfo send a request to my URL and determine application connectivity state. But it’s not working on Android. Even returning reachabilityTest as false won’t work.

Reproducible Demo

  const netInfo = useNetInfo({
    reachabilityUrl: baseURL,
    reachabilityTest: async (response) => {
      console.log(response);
      return false;
    },
    reachabilityLongTimeout: 60 * 1000,
    reachabilityShortTimeout: 5 * 1000,
    reachabilityRequestTimeout: 15 * 1000,
  });

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tmiruncommented, Sep 1, 2020

@hamidfzm i was checking this error i think the library do the right things: look the image:

image

I tested when your device is android will return directly isInternetReachable variable from native code. so the code of reachabilityTest will not be executed it only will be executed when native code return typeof state.isInternetReachable !== boolean

i hope this comment can help you =)

0reactions
mikehardycommented, Nov 13, 2021

It does not appear based on the docs that you may specify a custom reachabilityTest @chrise86 - when you inspected the code here, does my assertion agree with your analysis?

Similar to this someone just added the ability to pass in a function that determines whether to run reachability tests or not #513 - it was done in a backwards-compatible way (the default function is the way it worked before). If you posted a PR like that we could merge it

Read more comments on GitHub >

github_iconTop Results From Across the Web

reachability request not being called · Issue #395 - GitHub
I'm expecting useNetInfo send a request to my URL and determine application connectivity state. But it's not working on Android.
Read more >
objective c - Reachability Notification Never Called
Your object Reachability is autorelease so it's dealloc and not working anymore. I try your code and it's working for me: AppDelegate.h code...
Read more >
Working with an Internet Connection on iOS with Swift
How to handle Internet Connection on iOS with Swift? Why you shouldn't use Reachability to check network status on iOS?
Read more >
What is Reachability Analyzer? - Amazon Virtual Private Cloud
Reachability Analyzer is a configuration analysis tool that enables you to perform connectivity testing between a source resource and a destination resource ...
Read more >
Reachability in iOS. Reachability no more….NWPathMonitor
Note: Reachability cannot tell your application if you can connect to a ... iOS Developer working with Swift and Objective-C Worked @X-Team, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found