问题描述
在安卓ICS,无线点对点(无线直接)API提供。
In Android ICS, Wireless P2P (WiFi Direct) API is provided.
我试图开发可同时连接2部电话通过无线P2P,如果自动的MAC地址匹配。
I tried to develop an Application which can connect 2 phones via Wireless P2P automatically if the MAC address match.
从SDK文档,我不得不步骤如下:
From SDK documentation, I have to following steps:
- 从设置打开无线网络直接。
- 在初始化P2P连接。 - 初始化()
- 发现同伴。 - discoverPeers()
- 看看MAC地址匹配。
- 连接到所发现的对等。 - 连接()
有一次,在connect()API调用,赛德手机会弹出一个连接认证对话框。 (根据WifiP2pConfig)
Once, the connect() API is called, Farside phone will Pop Up a connection Authentication Dialog. (Depending on WifiP2pConfig)
反正有自动连接,无需赛德,弹出对话框?
Is there anyway to connect automatically, without having Farside to popup the Dialog?
推荐答案
这似乎验证对话框的自动化是不可能的,这使得P2P路由不可能为好。显示器/键盘/标签/ PBC:眼下,WpsInfo类(用于在对等连接期间被传递到WifiP2pManager的connect()函数的WifiP2pConfig类)仅在四个方面显示身份验证对话框。我认为,PBC(按钮配置)是默认的就是你参考。其他3个选择所需要的用户输入式PIN的,这使得它们更不能用于自动连接。也许,如果我们要找到这个身份验证对话框类的类型,我们可以自动的确定按钮的点击?
It seems that automation of authentication dialogs is not possible, and this makes p2p routing impossible as well. Right now, the WpsInfo class (which is used in the WifiP2pConfig class that gets passed into the WifiP2pManager's connect() function during peer connection) only displays authentication dialogs in four ways: DISPLAY / KEYPAD / LABEL / PBC. I believe that PBC (push button config ) is the default and is what you refer to. The other three options require the user to input a type of pin, making them even more unusable for automated connections. Maybe if we were to find the type of this authentication dialog class, we could automate the clicking of the 'ok' button?
我希望可以增加一个新的选择,将得到的应用程序进行认证的连接,而不是用户的能力。这种基于用户的身份验证看起来像它被结转蓝牙API,并严重限制的WiFi直接的效用。也许人们在谷歌可以帮助我们吗?
I wish a new option could be added that would give the application the ability to authenticate a connection, rather than the user. This user based authentication looks like its been carried over from the bluetooth api, and severely limits the usefulness of wifi direct. Maybe the folks at google could help us out?
这篇关于自动认证为Android的WiFi直的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!