Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不知道它是在本机 API 中还是只是我的 GS3。Wifi direct 会在 5 分钟不活动后自动关闭。有什么办法可以保持吗?或以编程方式打开它?
谢谢
您可以使用 Wi-Fi 锁:
WifiLock wifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, "mylock"); wifiLock.acquire();
当你不再需要网络时,你应该释放锁:
wifiLock.release();