簡體   English   中英

是否可以通過編程方式在android 4上打開移動熱點?

[英]Is it possible to turn on programmatically the mobile hotspot on android 4?

  1. 是否可以通過編程方式激活Android手機上的移動熱點?
  2. 如果激活了移動位置,是否可以在應用中以編程方式讀取手機移動熱點的配置(SSID,密碼,安全性WPA ...),以通過NFC將其發送到另一部手機?

我發現的消息來源說:“不可能,沒有具有此功能的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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM