Created
September 1, 2015 16:13
-
-
Save mortenjust/1fbdbb290455ab3a5268 to your computer and use it in GitHub Desktop.
Check for tethering, hotspot, access point on android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isSharingWiFi(final WifiManager manager) | |
{ | |
try | |
{ | |
final Method method = manager.getClass().getDeclaredMethod("isWifiApEnabled"); | |
method.setAccessible(true); //in the case of visibility change in future APIs | |
return (Boolean) method.invoke(manager); | |
} | |
catch (final Throwable ignored) | |
{ | |
} | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment