Reputation: 2881
HI i am connecting to a mobile wifi hotspot AP. How can find that connected wifi network is mobile hotspot are not?Could you please help me out from this. Thanks in advance.
Upvotes: 0
Views: 174
Reputation: 13616
One other potential option would be to make a call to a remote endpoint such as a webserver, determine the external IP address, then lookup to see if that IP address is in a range of known cellular carrier subnets. This is probably the highest accuracy solution I can think of, but of course requires much more infrastructure to work.
Upvotes: 0
Reputation: 55340
You can use ConnectivityManagerCompat.isActiveNetworkMetered()
, from the support library. Check this answer for more information.
It will return true both for mobile data connections and wifi networks that correspond to mobile APs.
Upvotes: 3