Android:查找连接到网络的设备列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3708345/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android: Findout list of devices connected to network
提问by Rakesh Gondaliya
I want to make application which gives me the list of all the devices that are connected to my current network connection.
我想制作一个应用程序,它为我提供了连接到我当前网络连接的所有设备的列表。
For eg. When i press on search button in bluetooth application gives me the list of bluetooth device that are in range , Similarly i need to develop application in when when i click on search button then it should able to give the list of all the devices that are connected to my network. I am familiar with the Networkmanager and the NetworkInfo Api.
例如。当我按下蓝牙应用程序中的搜索按钮时,我会得到范围内蓝牙设备的列表,同样,当我点击搜索按钮时,我需要开发应用程序,然后它应该能够提供连接的所有设备的列表到我的网络。我熟悉 Networkmanager 和 NetworkInfo Api。
If u have any idea how can i do this,please guide me.
如果你有任何想法我该怎么做,请指导我。
Thank you
谢谢
回答by John Hawkins
If you mean you want to see all the devices connected to your current WiFi connection (and you are not trying to do Ad Hoc networking), then you are essentially wanting to run a network scanner.
如果您的意思是要查看连接到当前 WiFi 连接的所有设备(并且您不想进行 Ad Hoc 网络),那么您实际上是想运行网络扫描仪。
There are a bunch of these around. This one has the source available on github
周围有一堆这样的。这个在github上有可用的源
回答by Pratik
This is possible now to get the network devices using NSD Android new feature and for this required minimum version 16 level Jellybean
现在可以使用 NSD Android 新功能获取网络设备,并且对于此所需的最低版本 16 级 Jellybean
Here is the link for NSD
这是 NSD 的链接
http://developer.android.com/training/connect-devices-wirelessly/nsd.html
http://developer.android.com/training/connect-devices-wireless/nsd.html