Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

WiFi scanning in Android programming (specify channel and active/passive)

Posted on 2014-11-25
Last Modified: 2014-12-10
Need help with a WORKING code examples for the following:

Active/Passive Wi-Fi scanning
Scan only specific Wi-Fi channel.  For example, when instead of scanning all 11 channels what if I only want to scan for all access points using channel 5?

Thanks in advance
Question by:Wayne88
  • 5
  • 2
LVL 13

Expert Comment

by:Molnar István
ID: 40466340
mWifiManager.startScanActive() and mWifiManager.startScan():
-Passive scanning listens to beacons sent by the access points. That means waiting for the beacon to be sent (usually a few seconds).
-An active scanning will emit probes to those APs immediately.
[ref: http://stackoverflow.com/questions/5958715/what-is-the-difference-between-active-scan-and-passive-scan]

see also: http://developer.android.com/reference/android/net/wifi/WifiManager.html

hope it helps
LVL 44

Expert Comment

ID: 40466406
You didn't really specify what language or IDE you're using, which would help if you want working code samples.
LVL 14

Author Comment

ID: 40469653
Hi Guys, sorry for the late reply.  Was having computer issues and haven't got a chance to code.  I am using Eclipse SDK.  Thank you.

Thanks Molnar, I will test as soon as I can get the laptop back running.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 44

Expert Comment

ID: 40469986
The links supplied are both for Java, if I'm not mistaken.

The only Eclipse IDE that I know of uses C/C++... so you might want to ask the administrators to add the C++ topic area for you. (i.e. click the Request Attention link under your original question.)
LVL 14

Author Comment

ID: 40479305
Hi Guys, finally got the pc running and Eclipse reinstalled.  I have read the link Molnar supplied before and I've tried it again.  The problem is that Eclipse wouldn't compile mywifi.startScanActive() because the method is not part of the SDK.  This is where I got stuck and Google is not producing much help.

LVL 14

Accepted Solution

Wayne88 earned 0 total points
ID: 40483395
After researching this issue further it seems as:

Active/Passive Wi-Fi scanning and single channel scanning is not part of the Android Eclipse SDK and there are hacks you can do to sideload IW from Linux but this is not an official solution.
LVL 14

Author Comment

ID: 40483398
Also, the phone must be rooted which is not practical.
LVL 14

Author Closing Comment

ID: 40490919
Can't be done using Eclipse SDK

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
computer science syllabus 3 89
add software to phone 13 119
Need to track Android phone using GPS when there is no Internet on the phone. 4 57
Group texting 7 81
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question