collect
Collects the current network connectivity status of the device.
This method checks if the device has an active internet connection by querying the system's connectivity manager. The implementation varies based on Android API level to ensure compatibility.
Return
NetworkInfo containing the current connectivity status
Throws
if Manifest.permission.ACCESS_NETWORK_STATE is not granted