获取用户通过wifi定义的android设备名称

编程入门 行业动态 更新时间:2024-10-28 16:23:54
本文介绍了获取用户通过wifi定义的android设备名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的Android应用中,我想检测在本地无线网络中找到的所有Android设备名称.我能够扫描网络并找到设备IP和完全合格的域名(FQDN),例如android-2120ee3b45******.我正在这样做:

In my Android app I want to detect all Android device names found in the local wireless network. I am able to scan the network and find the devices IP and full qualified domain name (FQDN) like android-2120ee3b45******. I'm doing it like:

final InetAddress inetAddress = InetAddress.getByName(ip); if (inetAddress.isReachable(400)) { final String host = inetAddress.getHostName(); final String canHost = inetAddress.getCanonicalHostName(); final String ip = inetAddress.getAddress(); }

使用java.InetAddress,我只能获得IP和网络名称,例如android-2120ee3b45******.但是我想要用户在设备上定义的Android设备名称,例如" Peters Fire TV "或" Mikes Samsung SGS6 ".我看到诸如AllConnect或AllCast之类的应用程序可以从Fire TV(这是一个Android设备)中获取此类名称.

With java.InetAddress I only get the IP and the network name like android-2120ee3b45******. But I want the Android device name defined by the user on the device like "Peters Fire TV" or "Mikes Samsung SGS6". I saw apps like AllConnect or AllCast which can grab such name from Fire TV (which is a android device).

如何获取用户通过WIFI网络定义的Android设备名称?

How can I get the Android device name defined by the user over the WIFI network?

推荐答案

添加此行,

for(i=0;i<WifiP2pDeviceList.size();i++){ WifiP2pDevice device = WifiP2pDeviceList.get(i); String deviceName=device.deviceName; String devicestatus=device.status; //so on }

更多推荐

获取用户通过wifi定义的android设备名称

本文发布于:2023-11-23 14:29:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621782.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定义   名称   用户   设备   wifi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!