Avatar of Wayne88
Wayne88Flag for Canada

asked on 

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

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
AndroidSmartphone Programming

Avatar of undefined
Last Comment
Wayne88
Avatar of Molnár István
Molnár István
Flag of Romania image

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
Avatar of Darr247
Darr247
Flag of United States of America image

You didn't really specify what language or IDE you're using, which would help if you want working code samples.
Avatar of Wayne88
Wayne88
Flag of Canada image

ASKER

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.
Avatar of Darr247
Darr247
Flag of United States of America image

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.)
Avatar of Wayne88
Wayne88
Flag of Canada image

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Wayne88
Wayne88
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Wayne88
Wayne88
Flag of Canada image

ASKER

Also, the phone must be rooted which is not practical.
Avatar of Wayne88
Wayne88
Flag of Canada image

ASKER

Can't be done using Eclipse SDK
Smartphone Programming
Smartphone Programming

Smartphones run using a variety of operating systems -- Android, iOS and Windows Mobile most commonly -- and an even wider variety of programming languages, including Objective-C, Java, Visual C#, C++ and .NET, not to mention HTML5 and JavaScript, and cross-platform frameworks such as PhoneGap.

8K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo