如何在Android中自动接受Wi-Fi Direct连接请求 [英] How to auto-accept Wi-Fi Direct connection requests in Android
问题描述
我有2个使用WiFi Direct的Android设备.在一个设备上,我可以使用WifiP2pManager
类获取有关另一设备的信息,并请求与另一设备的连接.但是,当我请求连接时,另一台设备会弹出一个小窗口,并询问用户是否要接受连接请求.
I have 2 Android devices using WiFi Direct. On one device I can get information about the other device using the WifiP2pManager
class, and request a connection to the other device. However when I request a connection, the other device pops up a little window and asks the user if they want to accept the connection request.
是否可以自动接受这些连接请求? I.E是否能够在无需用户确认的情况下连接到其他设备?
Is it possible to auto-accept these connection requests? I.E to be able to connect to the other device without user confirmation?
推荐答案
基于注释,如果您只想跟踪和记录周围的车辆,您真的需要连接到设备吗?
Based on the comments, do you really need to connect to the devices if you just want to track and log the vehicles around you ?
我不知道项目的范围,但是您可以简单地使用WifiP2pDeviceList . wifi.p2p.WifiP2pManager.Channel,%20android.net.wifi.p2p.WifiP2pManager.PeerListListener%29"rel =" nofollow>请求WifiP2pManager中的对等端.您可以获得周围设备的列表(〜=车辆),并可以记录下来.
I don't know the scope of the project, but you could simply use the WifiP2pDeviceList that you get when you request the peers in the WifiP2pManager. You could get the list of the devices (~= vehicles) around you and could log this.
如果您想发送更详细的信息,则连接很有用.
Connection is useful if you want to send more detailed information I guess.
这篇关于如何在Android中自动接受Wi-Fi Direct连接请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!