English 中文(简体)
获取信息信息与获取信息以发现信号力量变化之间的差别
原标题:difference between getConnectionInfo() and getScanResults() to detect signal strength changes

I m trying to detect signal strength changes in a wifi connection. I m confused of which method I should use in my BroadcastReceiver. What is the difference between using getConnectionInfo() and getScanResults() - from which then I can use relevant method to get the rssi value?

例如,如果我使用ConnectionInfo(ConnectionInfo),那么后来我使用SedRssi()。 或者,我可以使用“一级”财产。

我使用Toast表示他们的价值观,它并不总是表现出同样的价值观。 当失去威静时,ConnectionInfo(.getRssi()显示——200,但结果。 水平仍然显示其以前的价值。

任何想法? 感谢!

String netSSID = wifi.wifiMgr.getConnectionInfo().getSSID();
int netRSSI = wifi.wifiMgr.getConnectionInfo().getRssi();

List<ScanResult> results = wifi.wifiMgr.getScanResults();
for (ScanResult result : results) {
    if (result.SSID.equalsIgnoreCase(netSSID)) {
        anothernetRSSI = result.level;
    }
}
问题回答

In 一句话,RSSI只能在你的装置和你与之有联系的接入点之间提供。 (RSSi是你与之有联系的接入点的信号水平)

但是,如果你想要达到所有维系通道的水平,那么你就应当使用开端扫描器,并取得扫描结果,并在宽度出入点获得每一等级的财产。

这是否有用?

只有当你使用<条码>启动Scan(<><>>>>>。 扫描仪是同步的,发送了<>SCAN_RESULTS_AVAILABLE_ACTION的广播。 而且,如果你与任何东西有关系,则扫描结果将适用于扫描发现的任何接入点,其中可能包括除你与之相联的接入点。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签