VenkaReddy
VenkaReddy

Reputation: 2881

How to know is connected wifi form mobile hotspot AP or not?

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

Answers (2)

Jeffrey Mixon
Jeffrey Mixon

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

matiash
matiash

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

Related Questions