Android的WifiP2p - 当发现设备无法去得到通知 [英] Android WifiP2p - Get notified when a discovered device goes unavailable

查看:754
本文介绍了Android的WifiP2p - 当发现设备无法去得到通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个WiFi的直接应用在我敢列出可用,当设备进入unavailble状态,我必须从列表中删除它的设备。

I'm developing a Wifi-direct app in which i'm listing the devices that are available and when the device goes to "unavailble" status i have to remove it from the list.

我试图与WifiDirectDemo样品,在列表中它成功地增加了发现的设备,但是当设备进入不可用它是没有得到通知。
当设备进入不可用WIFI_P2P_PEERS_CHANGED_ACTION的意图不被解雇。

I tried with the WifiDirectDemo sample, it successfully adds discovered devices in the list but when the device goes unavailable it is not getting notified. "WIFI_P2P_PEERS_CHANGED_ACTION" intent is not fired when device goes unavailable.

当我尝试discoverPeers了,onPeersAvailable的方法得到那些已经发现的设备列表。它不删除unavailble设备。

When i try "discoverPeers" again, "onPeersAvailable" method gets the device list that are already discovered. It is not removing the unavailble devices.

有什么办法时,器件是不可用得到通知?

Is there any way to get notified when the device goes unavailable?

推荐答案

<一个href=\"http://stackoverflow.com/questions/21072081/how-to-be-notified-when-a-peer-is-no-longer-available-in-the-wi-fi-direct-range\">Have一看这帖子

在总和:同行谁走出去的范围会自动在一段时间后的同龄人名单中删除 - 这可能属于直到1分钟。
我与S4和S5迷你设备进行测试。 S5迷你发现了S4设备 - 当我关掉无线上网花了大约20秒S4设备上,那么S5小型设备broadcastes一个PEERS_CHANGED一个行动的S4没有任何appera再在DEVICELIST ...

in sum: peers who go out of the range will be automatically delete in the peers list after some time - this could belong until 1 minute. I test it with an s4 and s5 mini device. s5 mini discovered the s4 device - when i turned off wifi on the s4 device it took about 20 seconds, then the s5 mini device broadcastes a PEERS_CHANGED Action an the s4 didn't appera any longer in the devicelist...

这篇关于Android的WifiP2p - 当发现设备无法去得到通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆