如何获得无线网络的名称使用了Android的API的Andr​​oid? [英] How to get name of wifi-network out of android using android API?

查看:115
本文介绍了如何获得无线网络的名称使用了Android的API的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,我应该使用的NetworkInterface :: getDisplayName。我得到了一些名字,但这个名字是不同的,这名字,我可以看到,当我选择在我想要连接的网络。

请帮助..

acording到洛士利回答:

  WifiManager wifiMgr =(WifiManager)getActivity()getSystemService(Context.WIFI_SERVICE)。
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
字符串名称= wifiInfo.getSSID();
 

解决方案

android.net.wifi.WifiInfo.getSSID

I thought that I should use NetworkInterface::getDisplayName. I got some name, but this name is different that this name which I can see, when I choosing to which network I want to connect.

Please help..

[EDIT]

acording to Loxley answer:

WifiManager wifiMgr = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
String name = wifiInfo.getSSID();

解决方案

android.net.wifi.WifiInfo.getSSID?

这篇关于如何获得无线网络的名称使用了Android的API的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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