【问题标题】:Is it possible to turn on programmatically the mobile hotspot on android 4?是否可以以编程方式打开 android 4 上的移动热点?
【发布时间】:2015-10-29 06:54:23
【问题描述】:
  1. 是否可以通过编程方式激活移动热点 安卓手机?
  2. 如果激活了移动热点,是否可以在应用程序中以编程方式读取手机移动热点的配置(SSID、密码、安全 WPA...),然后通过 NFC 将其发送到另一部手机?

我找到的消息来源说“不可能,没有具有此功能的 SDK”,但此消息来源是 2010 年到 2011 年之间。

感谢您的回答!

【问题讨论】:

  • android 文档中没有这样的东西。我正在研究查看 android 的源代码并做某事的可能性。你走了多远?
  • 我没有找到这个方向的东西。也许由于安全方面的原因,现在可以通过应用程序将手机激活为移动热点或为此读取网络密钥...

标签: android wifi android-wifi


【解决方案1】:

是的,试试这个方法……

     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);
}

【讨论】:

    猜你喜欢
    • 2014-11-04
    • 1970-01-01
    • 2011-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多