Unfortunately, there is no way to determine if you have an internet connection with the current Android API . You can determine if an adapter is connected to the router (WiFi, 3G, LTE, etc.).
However, can you implement something related to a well-known domain (www.google.com)? To determine in your connection is valid, but it will take time (a second or greater value for a bad connection).
source share