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

Wayne88
Wayne88 used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Molnár IstvánHelpDesk / Programmer

Commented:
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
You didn't really specify what language or IDE you're using, which would help if you want working code samples.
Top Expert 2015

Author

Commented:
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.
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

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.)
Top Expert 2015

Author

Commented:
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.

http://stackoverflow.com/questions/6234728/missing-method-in-android-net-wifi-wifimanager
Top Expert 2015
Commented:
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.
Top Expert 2015

Author

Commented:
Also, the phone must be rooted which is not practical.
Top Expert 2015

Author

Commented:
Can't be done using Eclipse SDK

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial