[英]Is it possible to turn on programmatically the mobile hotspot on android 4?
我發現的消息來源說:“不可能,沒有具有此功能的SDK”,但這是2010年至2011年之間的消息。
感謝您的回答!
是的,嘗試這種方法...
WifiManager wifiManager = (WifiManager) getBaseContext()
.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(false);
try {
wifiManager.getClass()
.getMethod("setWifiApEnabled",
WifiConfiguration.class,
boolean.class)
.invoke(wifiManager, null, false);
} catch (Exception e) {
Log.e(Main.TAG, "Cannot call: setWifiApEnabled", e);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.