As the title describes, I am developing android application, and I want to know whether the current WIFI connection is a hotspot connection. If so, I will pause the download process so that the cellular data will not be wasted. I did not find any official APIs that can do this functionality. So I wonder if anyone has done something about it?
Asked
Active
Viewed 148 times
1 Answers
0
The ConnectivityManager
method isActiveNetworkMetered() (or the equivalent ConnectivityManagerCompat.isActiveNetworkMetered() if you need to support devices less than API 16) tells you exactly when a network is metered. A WiFi hotspot will be a metered connection.

ianhanniballake
- 191,609
- 30
- 470
- 443
-
This method is supported on API 16 and higher, right? Is there any other way for API lower than 16? – Mike Sep 06 '16 at 14:35
-
@Mike - the Compat method listed works back to API 9, although prior to API 16 there is no separate 'metered' status so it is only checking for wifi prior to API 16. – ianhanniballake Sep 06 '16 at 16:15
-
OK, Thanks a lot. – Mike Sep 12 '16 at 14:55