Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created September 1, 2015 16:13
Show Gist options
  • Save mortenjust/1fbdbb290455ab3a5268 to your computer and use it in GitHub Desktop.
Save mortenjust/1fbdbb290455ab3a5268 to your computer and use it in GitHub Desktop.
Check for tethering, hotspot, access point on android
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;
}
<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