【问题标题】:On Android 2.2: Being in Tethering mode and scanning wifi at the SAME time在 Android 2.2 上:同时处于网络共享模式和扫描 wifi
【发布时间】:2011-03-23 14:39:27
【问题描述】:

嗨:通常是否可以打开 Wifi Tethering(创建热点)并同时扫描 Wifi 设备?我想要几个设备相互发现(不连接)并记录信号强度。为此,所有设备都必须可以通过 Wifi 发现并同时发现其他设备。 对于某些特定的用例,我只需要它..

【问题讨论】:

    标签: java android wifi jvm-hotspot signal-strength


    【解决方案1】:

    您似乎无法在 android 中默认执行此操作:如果您启用了 wifi 网络共享,您将无法使用任何 wifi 连接功能(包括扫描)。这是一项独家功能:系绳或 wifi 客户端。 当您启用网络共享时,WifiManager 似乎处于 WIFI_UNKNOW 状态。 我也在对此进行调查,但到目前为止我找不到任何解决方案。

    这些来自最新的 Froyo API(此方法标记为 @hide),但我认为您可以通过反射访问它,我希望。

     public boolean setWifiApEnabled(WifiConfiguration  wifiConfig, boolean enabled)
    
    Start AccessPoint mode with the specified configuration. If the radio is already running in AP mode, update the new configuration Note that starting in access point mode disables station mode operation
    

    如您所见,AP 模式将禁用工作站模式操作(扫描等)

    我刚试过:可以使用反射并调用方法来启动WifiAP。 然后,如果您在 WifiManager 上调用 startScan() 方法,您将得到错误响应,因此扫描在启用 WifiAP 时不起作用。

    马可

    【讨论】:

    • 感谢您的评价!如果这是由于硬件限制或由于 android 系统同时执行这两种操作,听到某人的消息会很有趣!?
    • 我现在才明白@markov00,...谢谢。您现在有解决方案吗?
    • 对不起@gumuruh,但那是大约 4 年前的事了,自回复之日起我就不再使用和测试该方法了。
    猜你喜欢
    • 2011-02-28
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 2011-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-19
    相关资源
    最近更新 更多