Check if there is internet connection

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Suleymanov

Currently my workaround is to request ad (AdMob) and see if it fails to load to detect there is no or poor internet. But is there a straight forward easy way of checking internet?

:bust_in_silhouette: Reply From: MrEliptik

From what I know, and looking through the docs, there’s no API to check internet connection. Your approach is usually what is done to check internet connection.

To make a simpler request you could request https://google.com or https://example.com/ which should always be up.

To add to this, you can check multiple websites that should always be up (google, amazon, bing) stopping when you get a hit, just in case the user has one of them blocked

timothybrentwood | 2021-05-06 11:33