You can useContext.getSystemService(Context.CONNECTIVITY_SERVICE).getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
orContext.getSystemService(Context.CONNECTIVITY_SERVICE).getNetworkInfo(ConnectivityManager.TYPE_WIFI)
and parse the DetailedState enum of the returned NetworkInfo object
and don't forget to allow it the Manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Source: stackoverflow.com
Documentation: http://developer.android.com/reference/android/net/ConnectivityManager.html
No comments:
Post a Comment