You can't directly check it.
However, you could either ping a server and see if the response takes very long or doesn't come back at all.
You could also do a speedtest. In most applications this would not make much sense though, because it's a hog on the user's data.