check internet reachable or not in china

397 views Asked by At

I need to check if internet accessible from the mobile or not in order to show a different view in my app.

My app is in react-native and I am using the plugin react-native-netinfo for this. but this plugin pings google for checking the connectivity. As Google is blocked in china I am getting is not connected though connected to internet. Is there any other site instead of http://google.com/generate_204

I can set the site name using the options provided:

NetInfo.configure({
            reachabilityUrl: 'http://google.com/generate_204',
            reachabilityTest: async response => response.status === 200,
            reachabilityLongTimeout: 60 * 1000, // 60s
            reachabilityShortTimeout: 50 * 1000, // 5s
            reachabilityRequestTimeout: 15 * 1000, // 15s
        });

I have tried using GitHub.com that's also now blocked in China. Is there any reliable site that I can use for long term as well specially for China?

Note: can check whether site usable in china or not using: http://www.chinafirewalltest.com

1

There are 1 answers

1
AIMIN PAN On

You can check www.baidu.com which is the search engine in China.

But this is not "Internet reachable", it is "site reachable". Even if www.baidu.com is reachable, it does not mean your target site is reachable.