Created
May 29, 2016 07:28
-
-
Save liyinsg/59360e745b14332ff195c80b9e6e4ea9 to your computer and use it in GitHub Desktop.
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
static private void enableSoftAP(Context context) { | |
try { | |
WifiManager wifiManager; | |
WifiConfiguration config = null; | |
wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); | |
Method method = wifiManager.getClass().getMethod("setWifiApEnabled", | |
WifiConfiguration.class, Boolean.TYPE); | |
method.invoke(wifiManager, config, true); | |
} catch (NoSuchMethodException e) { | |
e.printStackTrace(); | |
} catch (InvocationTargetException e) { | |
e.printStackTrace(); | |
} catch (IllegalAccessException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment