Archive for the ‘WiFi’ Category

802.11g

Posted: September 2, 2011 in WiFi

802.11g is one of the standards used for high speed wireless networks, commonly known as Wifi. This standard was created by the IEEE (Institute of Electrical and Electronics Engineers) in June of 2003 and uses a 2.4 to 2.5 gigahertz radio frequency to send and receive data from one device to another. There are several standards that are in use today for wireless communication, others include 802.11a, 802.11b and 802.11n. The standard 802.11g is becoming quite popular during the last several years for its speed, quality of transmission and competitive price.

More people than ever are building Wifi networks, either for their business, home use or for commercial enterprises such as to provide Internet access at a cafe. For many people, building a Wifi network usually involves the standard 802.11g.

In order to set up a home or business Wifi network on the 802.11g standard, you will need an 802.11g wireless router and an 802.11g compatible Wifi card. Usually a Wifi router is hooked up to either a broadband Internet connection or a computer server. In order for each part of the network to communicate with one another it is necessary that they all have a Wifi card able to send and receive 802.11g signals.

802.11g has become very popular as a Wifi standard in the last couple of years due to 5 major attributes. They include Speed, Range, Clarity of the Signal, Price and Compatibility

802 11g 802.11g

Speed

The max speed of 802.11g is 54 megabits per second; however expect around 11 megabits per second in normal day to day use.

Range

802.11g delivers a range of about 33 meters or about 100 feet. While this is less than its cousin 802.11b which delivers a range of about 150 feet, most people’s networks are well within this range’s limits. It is important to note that range can vary depending on many factors including whether a network is set up in an apartment, office environment, if a router is on another floor than computers tied into the network or if there is interference from signals operating close to 802.11g’s.

Clarity of the Signal

802.11g operates on the frequency 2.4 -2.5 GHZ, for the most part, the clarity of the signal is generally clear and interference free. In addition, this frequency works well penetrating walls or other types of building obstructions due to the fact it operates at low frequencies.

Price

The Price for 802.11g is relatively affordable for both corporations, home based businesses and private home networks. Expect price points around the $100 mark for both the router and Wifi cards.

Compatibility

A great reason to choose 802.11g is due to its downward compatibility with 802.11b. The “b” standard is widely used and “g” can work seamlessly with this standard.

Other 802.11 Standards

802.11b

Besides 802.11g, you should be aware of other types of standards most notably 802.11b. 802.11b is another common standard similar to “g” except that its speed is much slower at about 11 megabits per second max. However, the range of the 802.11b is slightly more than the “g” standard. Where “g” has a range of about 33 meters (100 feet), “b” standard has a range of 50 meters (150 feet). Regarding price, “b” is a little less expensive.

802.11a

This is another standard actually created at the same time as 802.11b. It operates at a higher frequency and thus sometimes has less interference. It should be noted that 802.11a has a shorter range than “b”. 802.11a is not as popular as “b” or “g”. Possibly the reason why this standard did not catch is because this standard is much more expensive than its cousin 802.11b making it less attractive to businesses and individuals.

Reference

http://www.tech-faq.com/80211g.html

Advertisements

In addition to cell phone GPS tracking and GSM tracking techniques, you can also track down a cell phone location using WiFi hotspots (or called WiFi access points).

The Boston-based company Skyhook Wireless is the first to use the WiFi hotspots to determine the location of a portable device without GPS; the accuracy is around some 20 to 30 meters. Skyhook Wireless has a database of more than 100 million WiFi access points surveyed by drivers and covers 70 percent of population centers in the United States and Canada, which enables it to provide locating service for Motorola Android cell phones.

In addition to Skyhook Wireless, Google has been doing the same thing. Google’s Street View car is equipped with commercially available Maxrad BMMG24005 omnidirectional radio antenna which receives publicly broadcast WiFi radio signals passively within range of the vehicle when travels at normal speed. The datacollected includes the header data, SSID, MAC addresses and the GPS coordinates of the vehicle.

The signals are then processed onboard in the vehicle, and then the data is transferred to Google’s location servers for further processing. Google use this data to provide location based service within Google products.

Here is how Google LBS service works:

– The user’s device sends a request to the Google location server with a list of MAC addresses which are currently visible to the device;
– The location server compares the MAC addresses seen by the user’s device with its list of known MAC addresses, and identifies associated geocoded locations (such as latitude / longitude);
– The location server then uses the geocoded locations associated with visible MAC address to triangulate the approximate location of the user;
– This approximate location is geocoded and sent back to the user’s device.

Reference

http://cellphonetrackers.org/track-down-a-cell-phone-location-using-wifi-hotspots.html

Title : How can I connect to Android with ADB over TCP?

Question I am attempting to debug an application on a Motorola Droid but I am having some difficulty connecting to the device via USB. My development server is a Windows 7 64bit VM running in HyperV and so I cannot connect directly via USB in the guest or from the host. I installed a couple of different USB over TCP solutions but the connection appears to have issues since the adb monitor reports “devicemonitor failed to start monitoring” repeatedly. I was wondering if there is a way to connect directly from the client on the development machine to the daemon on the device using the network instead of the usb connection or possibly other viable options?

 

Solution According to a post on xda-developers, you can enable ADB over WiFi from the device with the commands setprop service.adb.tcp.port 5555stop adbdstart adbd And you can disable it and return ADB to listening on USB with setprop service.adb.tcp.port -1stop adbdstart adbd If you have USB access already, it is even easier to switch to using WiFi. From a command line on the computer that has the device connected via USB, issue the commands adb tcpip 5555adb connect 192.168.0.101:5555 To tell the ADB daemon return to listening over USB adb usb There are also several apps on the Android Market that automate this process. Solution from adb –help connect : – connect to a device via TCP/IP Thats a command line option by the way. You should try connecting the phone to your wifi, and then get its IP from your router, its not going to work on the cell network The port is 5554 Solution Have you found anything? Basically, how to start the adb daemon on the phone without a USB connection ?

 

Solution I do not know how to connect the device without any USB connection at all, but if you manage to connect it maybe at another computer you can switch the adbd to TCP mode by issuing adb tcpip from a terminal and connect to your device over wifi from any PC on the network by: adb connect : Maybe it is also possible to switch to TCP mode from a terminal on the device.

 

Solution this is really simple. 1st make sure you are rooted.download a terminal emulator from market. (there are lots that are free)make sure that your android is connected to your wifi and get the wifi ip address.open the terminal program and type: su setprop service.adb.tcp.port 5555 stop adbd start adbd now go to your computer (assuming that you are using windows) create a shortcut on the desktop for “cmd.exe” (without the quotations). right click on the cmd shortcut and choose “Run as Administrator” change to your android-sdk-windows\tools folder type: adb connect wifi.ip.address:5555 (example: adb connect 192.168.0.105:5555) adb should now say that you are connected. note: if you are too fast to give the connect command it may fail. so try at least 2 times 5 seconds apart before you say this doesn’t work.

 

Solution I ended up getting the Eltima USB to Ethernet software working after finally giving up on the possibility of a direct to device connection over TCP. I have pretty much decided that it is not possible to connect to a device across the network only an emulator. If anyone finds out differently please update this post. thanks

 

Reference

http://techsoftcomputing.com/faq/3623727.html

Since  the time I upgraded to Nexus One, I had been thinking of various applications for my old Android phone, G1. Since Android is a powerful platform for Hacks N Mods, even an outdated Android phone would never go useless.

One of the things I had been thinking of was remote Surveillance (with motion detection), which is still under the works. Another one was to use it as a Internet radio by interfacing with an older music system with decent audio output.

Pandora and Stitcher together make-up a Full  streaming Radio (Podcasts and music on demand). But the real problem is controlling the Android Phone. How do I change channel, it can’t be done from remote!

The solution is already there, needs a very basic setup and you will be all set to go. All you need is an app that lets you remotely control Android Phone using any computer: Mac, Windows PC, Linux (all flavors), and even another Android phone , Cool isn’t it?

Whether your Android Phone is kept at a distance and you are lazy sitting on your couch, grab another device thats near to you and control your Android Phone remotely.

Method I: Android VNC Server

The app lets you connect to your Android device remotely via WiFi or USB. Connecting via USB requires port 5901 forwarding from device to PC using the following adb command –> adb forward tcp:5901 tcp:5901, then connect to localhost:5901 from your VNC client.

Features of Android VNC Server include:

  • GUI to start/stop server and set password
  • Set password to access
  • Input events are handled by uinput (no need to manually set devices)

Requires you to Root Android device.

Few Quick Tips on using Android VNCServer:
– Right click acts as “home” button press
– Escape on the keyboard acts as the “back” button
– Cursor keys work fine.

The app is available to download free in the Market.

Update: You can use Droid Vnc Server (market) as well.

Step 1. Download and Install VNC server apk on your Android Phone OR from Android Market
Step 2. Install VNC client on your Computer. There are wide options to chose from: Real VNCViewer, Tight VNCviewer, or any other.
Step 3. Determine Android Phone’s IP address and configure your VNC viewer to connect to that IP address.
Step 4. Connect and control.

VNCServer Compatibility List:

  • HTC G1 – Working
  • HTC Magic CyanogenMod 5.08 – Working
  • HTC Nexus Froyo FRF83 rooted+deodexed – Working
  • HTC Desire – Working
  • HTC Nexus Froyo FRF85b – Working
  • Motorola Droid – Not Working

Method II: Android Screencast

Android Screencast is n desktop app which lets you control an Android device using Mouse & Keyboard through USB. If you wish to keep your Phone connected all the time, this would be a better option.

Pre-requisites:

  • Android Phone should be Rooted (for controls, view only works as is)
  • Download Android SDK and extract it

Step 1. Connect phone to USB & ensure that you have Android debugging enabled, and then check connectivity via “adb devices” (If you use eclipse, this should be easy, else run that command from extracted directory/tools.

Step 2. Install JRE (Java runtime environment) if not already, Download and launch JNLP file. Clicking ont hta link should auto-launch it. If it doesn’t, save the JNLP into a folder and run it from command line using “javaws <jnlp file>”.

Step 3. A New window should popup that lets you control your Android using mouse & keyboard.

Reference

End-user Localization Platforms

Posted: March 9, 2011 in Mapping, WiFi

2.1 End-user Localization Platforms

Let us start with two previous works that have resulted in end-user applications. The technical details of both of them are not published.

2.1.1 Examples of End-user Localization Platforms

Google’s My Location My Location is a GPS-like location service that works without a GPS receiver. My Location is published as a feature within Google Maps for Mobile 2.0 (GMM) in the late 2007. The ”my location” feature exploits the GPS location of the mobile device, if it is available. If the GPS location is not available, the software determines the nearest wireless networks and cell sites. The software then  nds the location of the cell site from a database of known wireless networks and cell sites. This localization method is working by triangulating the different signal strengths from different cell transmitters and with the knowledge of their locations, which of course are retrieved from the online database, this helps My Location to determine the user’s current location. Similar approach is applied in wireless network location method . It discovers the nearby WiFi hotspots and using their location property, which is as well retrieved from the online WiFi database, to help discovering the user’s location. The order in which these services take precedence is[4]:

• GPS-based services

• WLAN-based / WiFi-based services

• Cell transmitter-based services

7Skyhook Wireless Technology The other end-user product that proposed non-GPS localization scheme is Skyhook Wireless. Skyhook Wireless technology developed by Skyhook Wireless company. It helps to determine the geographical location using Wi-Fi as the underlying reference system. It mainly works similarly to Google’s My Location wireless network location method. It uses the MAC addresses of audible wireless access points and proprietary algorithms to determine the position of a mobile device within 20-30 meters according to their reports.

2.1.2 Discussion

The main difference between Google’s My Location and Skyhook Wireless Technology is how they build their databases. Google makes use of their widely deployed Google Maps application. The application collects the surrounding access point and cell sites identification information and associates them with the GPS location if available, and then sends all such information to Google servers. Of course, millions of records are submitted daily to Google servers as a result of running Google Maps application on mobile all over the world. Google runs complicated algorithms on the returned data to aggregate them together and builds the database that correlates each access point or cell site to its location which would be returned later on when the location of a non-GPS device is requested through My Location service.

Skyhook Wireless uses a different way of building the data base holding the location information of Wifi access points identified by their MAC addresses. It uses a methodology called wardriving. Wardriving is the act of searching for Wi-Fi wireless networks by a person in a moving vehicle, using a portable computer or PDA. For example, you install Skyhook’s application on your GPS-enabled laptop, you get into your car, run the application and start driving. While the application is running it collects the audible access points as well as the current location of the car from the GPS device. All those information are sent back to Skyhook severs to run their proprietary algorithms and build their own database. They also made a technology named XPS, Figure 2.2: a hybrid positioning engine that integrates the Wi-Fi Positioning System from Skyhook Wireless with other complementary location systems. . XPS is configured to integrate/synthesize the location output of the Wi-Fi Positioning System and other positioning systems. It uses several different techniques to determine which source system is most reliable at any given moment. In some cases, XPS estimates the error of each of its source systems and favors the one with the highest degree of confidence at that particular moment. In other cases, the usage scenario or the confidence history of each source are leveraged. In every case, XPS uses this data to decide which source to favor or how to combine the various inputs into a superior overall calculation.

While the previous two techniques seem really promising, especially they ended up into real application for the end-user and are not just couple of research papers, they have very critical drawbacks. The  first drawback of those techniques is the coverage. While GPS provides 100% coverage by definition, My Location’s and Skyhook’s coverage totally depends on the information in their own databases. In countries like United States, Canada and many countries in Europe coverage is acceptable and they claim to be covering 70%. Nevertheless, in the rest of world, the coverage ratio is much lower than that. This can be improved by time of course, but still at the moment, it is a stopping issue. Another point is that in urban areas it is probable to find high density of wifi access points that can help in finding a relatively accurate location. But on highways, they would use the cell site technique which results in location with error in terms of kilometers.

Another drawback is their high dependence on Internet connectivity. They need to communicate with the appropriate servers to find location estimates of the heard wifi hotspots and/or cell sites. This introduces mutli-dimension problem; the availability, the cost, and the power consumption. Relying on Internet connectivity that heavily results in total failure if the connection is lost for any reason. Both techniques will be unable to  find location estimate without Internet connectivity unless by using GPS. Also this introduces additional cost to the localization process. One now needs to pay Internet communication fees each time he tries to find his own location. Although caching and pre-fetching can partially solve those problems, but they will introduce other technical problems that may affect the freshness of data. Radio communications consume relatively high amount of energy. That is why depending on how frequent the technique is performing Internet communications, the scheme would consume a significant amount of power. Another major problem is the freshness of the data. Those databases that hold the location information need to be updated from time to another. For example people moving from apartment to another mostly would result in moving at least one access point to another location. If the database is not updated, a wrong location would be calculated for devices querying their location in the proximity of this access point. This needs repeating the process of wardriving from time to another which an expensive operation that adds to the cost of the localization technology.

 

Reference:

http://www.mamir.net/masters/mamir_thesis.pdf

 

package android.net.wifi

Posted: March 3, 2011 in Android, Java, WiFi
package 

android.net.wifi

Provides classes to manage Wi-Fi functionality on the device.The Wi-Fi APIs provide a means by which applications can communicate with the lower-level wireless stack that provides Wi-Fi network access. Almost all information from the device supplicant is available, including the connected network’s link speed, IP address, negotiation state, and more, plus information about other networks that are available. Some other API features include the ability to scan, add, save, terminate and initiate Wi-Fi connections. 

Remember, not all Android devices are guaranteed to have Wi-Fi functionality.

Classes

ScanResult Describes information about a detected access point.
WifiConfiguration A class representing a configured Wi-Fi network, including the security configuration.
WifiConfiguration.AuthAlgorithm Recognized IEEE 802.11 authentication algorithms.
WifiConfiguration.GroupCipher Recognized group ciphers.
WifiConfiguration.KeyMgmt Recognized key management schemes.
WifiConfiguration.PairwiseCipher Recognized pairwise ciphers for WPA.
WifiConfiguration.Protocol Recognized security protocols.
WifiConfiguration.Status Possible status of a network configuration.
WifiInfo Describes the state of any Wifi connection that is active or is in the process of being set up.
WifiManager This class provides the primary API for managing all aspects of Wi-Fi connectivity.
WifiManager.MulticastLock Allows an application to receive Wifi Multicast packets.
WifiManager.WifiLock Allows an application to keep the Wi-Fi radio awake.

Enums

SupplicantState From defs.h in wpa_supplicant.
public class 

ScanResult

extends Object
implements Parcelable

java.lang.Object
android.net.wifi.ScanResult

Class Overview

Describes information about a detected access point. In addition to the attributes described here, the supplicant keeps track of qualitynoise, and maxbitrate attributes, but does not currently report them to external clients.

Summary

[Expand] 

Inherited Constants
From interface android.os.Parcelable
Fields
public String BSSID The address of the access point.
public String SSID The network name.
public String capabilities Describes the authentication, key management, and encryption schemes supported by the access point.
public int frequency The frequency in MHz of the channel over which the client is communicating with the access point.
public int level The detected signal level in dBm.
Public Methods
String toString() 

Returns a string containing a concise, human-readable description of this object.
[Expand] 

Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public String BSSID

Since: API Level 1

The address of the access point.

public String SSID

Since: API Level 1

The network name.

public String capabilities

Since: API Level 1

Describes the authentication, key management, and encryption schemes supported by the access point.

public int frequency

Since: API Level 1

The frequency in MHz of the channel over which the client is communicating with the access point.

public int level

Since: API Level 1

The detected signal level in dBm. At least those are the units used by the TI driver.

Public Methods

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object’s type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.
public class 

WifiConfiguration

extends Object
implements Parcelable

java.lang.Object
android.net.wifi.WifiConfiguration

Class Overview

A class representing a configured Wi-Fi network, including the security configuration. Android will not necessarily support all of these security schemes initially.

Summary

Nested Classes
class WifiConfiguration.AuthAlgorithm Recognized IEEE 802.11 authentication algorithms.
class WifiConfiguration.GroupCipher Recognized group ciphers.
class WifiConfiguration.KeyMgmt Recognized key management schemes.
class WifiConfiguration.PairwiseCipher Recognized pairwise ciphers for WPA.
class WifiConfiguration.Protocol Recognized security protocols.
class WifiConfiguration.Status Possible status of a network configuration.
[Expand] 

Inherited Constants
From interface android.os.Parcelable
Fields
public String BSSID When set, this network configuration entry should only be used when associating with the AP having the specified BSSID.
public String SSID The network’s SSID.
public BitSet allowedAuthAlgorithms The set of authentication protocols supported by this configuration.
public BitSet allowedGroupCiphers The set of group ciphers supported by this configuration.
public BitSet allowedKeyManagement The set of key management protocols supported by this configuration.
public BitSet allowedPairwiseCiphers The set of pairwise ciphers for WPA supported by this configuration.
public BitSet allowedProtocols The set of security protocols supported by this configuration.
public boolean hiddenSSID This is a network that does not broadcast its SSID, so an SSID-specific probe request must be used for scans.
public int networkId The ID number that the supplicant uses to identify this network configuration entry.
public String preSharedKey Pre-shared key for use with WPA-PSK.
public int priority Priority determines the preference given to a network bywpa_supplicant when choosing an access point with which to associate.
public int status The current status of this network configuration entry.
public String[] wepKeys Up to four WEP keys.
public int wepTxKeyIndex Default WEP key index, ranging from 0 to 3.
Public Constructors
WifiConfiguration()
Public Methods
String toString() 

Returns a string containing a concise, human-readable description of this object.
[Expand] 

Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public String BSSID

Since: API Level 1

When set, this network configuration entry should only be used when associating with the AP having the specified BSSID. The value is a string in the format of an Ethernet MAC address, e.g., XX:XX:XX:XX:XX:XX where each X is a hex digit.

public String SSID

Since: API Level 1

The network’s SSID. Can either be an ASCII string, which must be enclosed in double quotation marks (e.g., "MyNetwork", or a string of hex digits,which are not enclosed in quotes (e.g., 01a243f405).

public BitSet allowedAuthAlgorithms

Since: API Level 1

The set of authentication protocols supported by this configuration. See WifiConfiguration.AuthAlgorithm for descriptions of the values. Defaults to automatic selection.

public BitSet allowedGroupCiphers

Since: API Level 1

The set of group ciphers supported by this configuration. See WifiConfiguration.GroupCipher for descriptions of the values. Defaults to CCMP TKIP WEP104 WEP40.

public BitSet allowedKeyManagement

Since: API Level 1

The set of key management protocols supported by this configuration. See WifiConfiguration.KeyMgmt for descriptions of the values. Defaults to WPA-PSK WPA-EAP.

public BitSet allowedPairwiseCiphers

Since: API Level 1

The set of pairwise ciphers for WPA supported by this configuration. See WifiConfiguration.PairwiseCipher for descriptions of the values. Defaults to CCMP TKIP.

public BitSet allowedProtocols

Since: API Level 1

The set of security protocols supported by this configuration. See WifiConfiguration.Protocol for descriptions of the values. Defaults to WPA RSN.

public boolean hiddenSSID

Since: API Level 1

This is a network that does not broadcast its SSID, so an SSID-specific probe request must be used for scans.

public int networkId

Since: API Level 1

The ID number that the supplicant uses to identify this network configuration entry. This must be passed as an argument to most calls into the supplicant.

public String preSharedKey

Since: API Level 1

Pre-shared key for use with WPA-PSK.

When the value of this key is read, the actual key is not returned, just a “*” if the key has a value, or the null string otherwise.

public int priority

Since: API Level 1

Priority determines the preference given to a network by wpa_supplicant when choosing an access point with which to associate.

public int status

Since: API Level 1

The current status of this network configuration entry.

public String[] wepKeys

Since: API Level 1

Up to four WEP keys. Either an ASCII string enclosed in double quotation marks (e.g., "abcdef" or a string of hex digits (e.g., 0102030405).

When the value of one of these keys is read, the actual key is not returned, just a “*” if the key has a value, or the null string otherwise.

public int wepTxKeyIndex

Since: API Level 1

Default WEP key index, ranging from 0 to 3.

Public Constructors

public WifiConfiguration ()

Since: API Level 1

Public Methods

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object’s type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.
public static class 

WifiConfiguration.AuthAlgorithm

extends Object

java.lang.Object
android.net.wifi.WifiConfiguration.AuthAlgorithm

Class Overview

Recognized IEEE 802.11 authentication algorithms.

Summary

Constants
int LEAP LEAP/Network EAP (only used with LEAP)
int OPEN Open System authentication (required for WPA/WPA2)
int SHARED Shared Key authentication (requires static WEP keys)
String varName
Fields
public static final String[] strings
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final int LEAP

Since: API Level 1

LEAP/Network EAP (only used with LEAP)

Constant Value: 2 (0x00000002)

public static final int OPEN

Since: API Level 1

Open System authentication (required for WPA/WPA2)

Constant Value: 0 (0x00000000)

public static final int SHARED

Since: API Level 1

Shared Key authentication (requires static WEP keys)

Constant Value: 1 (0x00000001)

public static final String varName

Since: API Level 1
Constant Value: “auth_alg”

Fields

public static final String[] strings

Since: API Level 1
public static class 

WifiConfiguration.GroupCipher

extends Object

java.lang.Object
android.net.wifi.WifiConfiguration.GroupCipher

Class Overview

Recognized group ciphers.

 CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]
 TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]
 WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key
 WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key (original 802.11)

Summary

Constants
int CCMP AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]
int TKIP Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]
int WEP104 WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key
int WEP40 WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key (original 802.11)
String varName
Fields
public static final String[] strings
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final int CCMP

Since: API Level 1

AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]

Constant Value: 3 (0x00000003)

public static final int TKIP

Since: API Level 1

Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]

Constant Value: 2 (0x00000002)

public static final int WEP104

Since: API Level 1

WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key

Constant Value: 1 (0x00000001)

public static final int WEP40

Since: API Level 1

WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key (original 802.11)

Constant Value: 0 (0x00000000)

public static final String varName

Since: API Level 1
Constant Value: “group”

Fields

public static final String[] strings

Since: API Level 1
public static class 

WifiConfiguration.KeyMgmt

extends Object

java.lang.Object
android.net.wifi.WifiConfiguration.KeyMgmt

Class Overview

Recognized key management schemes.

Summary

Constants
int IEEE8021X IEEE 802.1X using EAP authentication and (optionally) dynamically generated WEP keys.
int NONE WPA is not used; plaintext or static WEP could be used.
int WPA_EAP WPA using EAP authentication.
int WPA_PSK WPA pre-shared key (requires preSharedKey to be specified).
String varName
Fields
public static final String[] strings
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final int IEEE8021X

Since: API Level 1

IEEE 802.1X using EAP authentication and (optionally) dynamically generated WEP keys.

Constant Value: 3 (0x00000003)

public static final int NONE

Since: API Level 1

WPA is not used; plaintext or static WEP could be used.

Constant Value: 0 (0x00000000)

public static final int WPA_EAP

Since: API Level 1

WPA using EAP authentication. Generally used with an external authentication server.

Constant Value: 2 (0x00000002)

public static final int WPA_PSK

Since: API Level 1

WPA pre-shared key (requires preSharedKey to be specified).

Constant Value: 1 (0x00000001)

public static final String varName

Since: API Level 1
Constant Value: “key_mgmt”

Fields

public static final String[] strings

Since: API Level 1

public static class 

WifiConfiguration.PairwiseCipher

extends Object

java.lang.Object
android.net.wifi.WifiConfiguration.PairwiseCipher

Class Overview

Recognized pairwise ciphers for WPA.

Summary

Constants
int CCMP AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]
int NONE Use only Group keys (deprecated)
int TKIP Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]
String varName
Fields
public static final String[] strings
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final int CCMP

Since: API Level 1

AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]

Constant Value: 2 (0x00000002)

public static final int NONE

Since: API Level 1

Use only Group keys (deprecated)

Constant Value: 0 (0x00000000)

public static final int TKIP

Since: API Level 1

Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]

Constant Value: 1 (0x00000001)

public static final String varName

Since: API Level 1
Constant Value: “pairwise”

Fields

public static final String[] strings

Since: API Level 1
public static class 

WifiConfiguration.Protocol

extends Object

java.lang.Object
android.net.wifi.WifiConfiguration.Protocol

Class Overview

Recognized security protocols.

Summary

Constants
int RSN WPA2/IEEE 802.11i
int WPA WPA/IEEE 802.11i/D3.0
String varName
Fields
public static final String[] strings
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final int RSN

Since: API Level 1

WPA2/IEEE 802.11i

Constant Value: 1 (0x00000001)

public static final int WPA

Since: API Level 1

WPA/IEEE 802.11i/D3.0

Constant Value: 0 (0x00000000)

public static final String varName

Since: API Level 1
Constant Value: “proto”

Fields

public static final String[] strings

Since: API Level 1
public static class 

WifiConfiguration.Status

extends Object

java.lang.Object
android.net.wifi.WifiConfiguration.Status

Class Overview

Possible status of a network configuration.

Summary

Constants
int CURRENT this is the network we are currently connected to
int DISABLED supplicant will not attempt to use this network
int ENABLED supplicant will consider this network available for association
Fields
public static final String[] strings
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final int CURRENT

Since: API Level 1

this is the network we are currently connected to

Constant Value: 0 (0x00000000)

public static final int DISABLED

Since: API Level 1

supplicant will not attempt to use this network

Constant Value: 1 (0x00000001)

public static final int ENABLED

Since: API Level 1

supplicant will consider this network available for association

Constant Value: 2 (0x00000002)

Fields

public static final String[] strings

Since: API Level 1
public class 

WifiInfo

extends Object
implements Parcelable

java.lang.Object
android.net.wifi.WifiInfo

Class Overview

Describes the state of any Wifi connection that is active or is in the process of being set up.

Summary

Constants
String LINK_SPEED_UNITS Link speed in Mbps
[Expand] 

Inherited Constants
From interface android.os.Parcelable
Public Methods
String getBSSID() 

Return the basic service set identifier (BSSID) of the current access point.
static NetworkInfo.DetailedState getDetailedStateOf(SupplicantState suppState) 

Map a supplicant state into a fine-grained network connectivity state.
boolean getHiddenSSID()
int getIpAddress()
int getLinkSpeed() 

Returns the current link speed in LINK_SPEED_UNITS.
String getMacAddress()
int getNetworkId() 

Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.
int getRssi() 

Returns the received signal strength indicator of the current 802.11 network.
String getSSID() 

Returns the service set identifier (SSID) of the current 802.11 network.
SupplicantState getSupplicantState() 

Return the detailed state of the supplicant’s negotiation with an access point, in the form of a SupplicantState object.
String toString() 

Returns a string containing a concise, human-readable description of this object.
[Expand] 

Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String LINK_SPEED_UNITS

Since: API Level 1

Link speed in Mbps

Constant Value: “Mbps”

Public Methods

public String getBSSID ()

Since: API Level 1

Return the basic service set identifier (BSSID) of the current access point. The BSSID may be null if there is no network currently connected.

Returns
  • the BSSID, in the form of a six-byte MAC address: XX:XX:XX:XX:XX:XX

public static NetworkInfo.DetailedState getDetailedStateOf (SupplicantState suppState)

Since: API Level 1

Map a supplicant state into a fine-grained network connectivity state.

Parameters
suppState the supplicant state
Returns

public boolean getHiddenSSID ()

Since: API Level 1
Returns
  • true if this network does not broadcast its SSID, so an SSID-specific probe request must be used for scans.

public int getIpAddress ()

Since: API Level 1

public int getLinkSpeed ()

Since: API Level 1

Returns the current link speed in LINK_SPEED_UNITS.

Returns
  • the link speed.
See Also

public String getMacAddress ()

Since: API Level 1

public int getNetworkId ()

Since: API Level 1

Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant. This method returns the ID for the currently connected network.

Returns
  • the network ID, or -1 if there is no currently connected network

public int getRssi ()

Since: API Level 1

Returns the received signal strength indicator of the current 802.11 network.

This is not normalized, but should be!

Returns
  • the RSSI, in the range ??? to ???

public String getSSID ()

Since: API Level 1

Returns the service set identifier (SSID) of the current 802.11 network. If the SSID is an ASCII string, it will be returned surrounded by double quotation marks.Otherwise, it is returned as a string of hex digits. The SSID may be null if there is no network currently connected.

Returns
  • the SSID

public SupplicantState getSupplicantState ()

Since: API Level 1

Return the detailed state of the supplicant’s negotiation with an access point, in the form of a SupplicantState object.

Returns

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object’s type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.
public class 

WifiManager

extends Object

java.lang.Object
android.net.wifi.WifiManager

Class Overview

This class provides the primary API for managing all aspects of Wi-Fi connectivity. Get an instance of this class by callingContext.getSystemService(Context.WIFI_SERVICE). It deals with several categories of items:

  • The list of configured networks. The list can be viewed and updated, and attributes of individual entries can be modified.
  • The currently active Wi-Fi network, if any. Connectivity can be established or torn down, and dynamic information about the state of the network can be queried.
  • Results of access point scans, containing enough information to make decisions about what access point to connect to.
  • It defines the names of various Intent actions that are broadcast upon any sort of change in Wi-Fi state.

This is the API to use when performing Wi-Fi specific operations. To perform operations that pertain to network connectivity at an abstract level, use ConnectivityManager.

Summary

Nested Classes
class WifiManager.MulticastLock Allows an application to receive Wifi Multicast packets.
class WifiManager.WifiLock Allows an application to keep the Wi-Fi radio awake.
Constants
String ACTION_PICK_WIFI_NETWORK Activity Action: Pick a Wi-Fi network to connect to.
int ERROR_AUTHENTICATING The error code if there was a problem authenticating.
String EXTRA_BSSID The lookup key for a String giving the BSSID of the access point to which we are connected.
String EXTRA_NETWORK_INFO The lookup key for a NetworkInfo object associated with the Wi-Fi network.
String EXTRA_NEW_RSSI The lookup key for an int giving the new RSSI in dBm.
String EXTRA_NEW_STATE The lookup key for a SupplicantState describing the new state Retrieve withgetParcelableExtra(String).
String EXTRA_PREVIOUS_WIFI_STATE The previous Wi-Fi state.
String EXTRA_SUPPLICANT_CONNECTED The lookup key for a boolean that indicates whether a connection to the supplicant daemon has been gained or lost.
String EXTRA_SUPPLICANT_ERROR The lookup key for a SupplicantState describing the supplicant error code if any Retrieve withgetIntExtra(String, int).
String EXTRA_WIFI_STATE The lookup key for an int that indicates whether Wi-Fi is enabled, disabled, enabling, disabling, or unknown.
String NETWORK_IDS_CHANGED_ACTION The network IDs of the configured networks could have changed.
String NETWORK_STATE_CHANGED_ACTION Broadcast intent action indicating that the state of Wi-Fi connectivity has changed.
String RSSI_CHANGED_ACTION The RSSI (signal strength) has changed.
String SCAN_RESULTS_AVAILABLE_ACTION An access point scan has completed, and results are available from the supplicant.
String SUPPLICANT_CONNECTION_CHANGE_ACTION Broadcast intent action indicating that a connection to the supplicant has been established (and it is now possible to perform Wi-Fi operations) or the connection to the supplicant has been lost.
String SUPPLICANT_STATE_CHANGED_ACTION Broadcast intent action indicating that the state of establishing a connection to an access point has changed.One extra provides the new SupplicantState.
int WIFI_MODE_FULL In this Wi-Fi lock mode, Wi-Fi will be kept active, and will behave normally, i.e., it will attempt to automatically establish a connection to a remembered access point that is within range, and will do periodic scans if there are remembered access points but none are in range.
int WIFI_MODE_SCAN_ONLY In this Wi-Fi lock mode, Wi-Fi will be kept active, but the only operation that will be supported is initiation of scans, and the subsequent reporting of scan results.
String WIFI_STATE_CHANGED_ACTION Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown.
int WIFI_STATE_DISABLED Wi-Fi is disabled.
int WIFI_STATE_DISABLING Wi-Fi is currently being disabled.
int WIFI_STATE_ENABLED Wi-Fi is enabled.
int WIFI_STATE_ENABLING Wi-Fi is currently being enabled.
int WIFI_STATE_UNKNOWN Wi-Fi is in an unknown state.
Public Methods
int addNetwork(WifiConfiguration config) 

Add a new network description to the set of configured networks.
static int calculateSignalLevel(int rssi, int numLevels) 

Calculates the level of the signal.
static int compareSignalLevel(int rssiA, int rssiB) 

Compares two signal strengths.
WifiManager.MulticastLock createMulticastLock(String tag) 

Create a new MulticastLock
WifiManager.WifiLock createWifiLock(int lockType, String tag) 

Creates a new WifiLock.
WifiManager.WifiLock createWifiLock(String tag) 

Creates a new WifiLock.
boolean disableNetwork(int netId) 

Disable a configured network.
boolean disconnect() 

Disassociate from the currently active access point.
boolean enableNetwork(int netId, boolean disableOthers) 

Allow a previously configured network to be associated with.
List<WifiConfiguration> getConfiguredNetworks() 

Return a list of all the networks configured in the supplicant.
WifiInfo getConnectionInfo() 

Return dynamic information about the current Wi-Fi connection, if any is active.
DhcpInfo getDhcpInfo() 

Return the DHCP-assigned addresses from the last successful DHCP request, if any.
List<ScanResult> getScanResults() 

Return the results of the latest access point scan.
int getWifiState() 

Gets the Wi-Fi enabled state.
boolean isWifiEnabled() 

Return whether Wi-Fi is enabled or disabled.
boolean pingSupplicant() 

Check that the supplicant daemon is responding to requests.
boolean reassociate() 

Reconnect to the currently active access point, even if we are already connected.
boolean reconnect() 

Reconnect to the currently active access point, if we are currently disconnected.
boolean removeNetwork(int netId) 

Remove the specified network from the list of configured networks.
boolean saveConfiguration() 

Tell the supplicant to persist the current list of configured networks.
boolean setWifiEnabled(boolean enabled) 

Enable or disable Wi-Fi.
boolean startScan() 

Request a scan for access points.
int updateNetwork(WifiConfiguration config) 

Update the network description of an existing configured network.
[Expand] 

Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_PICK_WIFI_NETWORK

Since: API Level 1

Activity Action: Pick a Wi-Fi network to connect to.

Input: Nothing.

Output: Nothing.

Constant Value: “android.net.wifi.PICK_WIFI_NETWORK”

public static final int ERROR_AUTHENTICATING

Since: API Level 1

The error code if there was a problem authenticating.

Constant Value: 1 (0x00000001)

public static final String EXTRA_BSSID

Since: API Level 1

The lookup key for a String giving the BSSID of the access point to which we are connected. Only present when the new state is CONNECTED. Retrieve with getStringExtra(String).

Constant Value: “bssid”

public static final String EXTRA_NETWORK_INFO

Since: API Level 1

The lookup key for a NetworkInfo object associated with the Wi-Fi network. Retrieve withgetParcelableExtra(String).

Constant Value: “networkInfo”

public static final String EXTRA_NEW_RSSI

Since: API Level 1

The lookup key for an int giving the new RSSI in dBm.

Constant Value: “newRssi”

public static final String EXTRA_NEW_STATE

Since: API Level 1

The lookup key for a SupplicantState describing the new state Retrieve with getParcelableExtra(String).

Constant Value: “newState”

public static final String EXTRA_PREVIOUS_WIFI_STATE

Since: API Level 1

The previous Wi-Fi state.

See Also
Constant Value: “previous_wifi_state”

public static final String EXTRA_SUPPLICANT_CONNECTED

Since: API Level 1

The lookup key for a boolean that indicates whether a connection to the supplicant daemon has been gained or lost. truemeans a connection now exists. Retrieve it with getBooleanExtra(String, boolean).

Constant Value: “connected”

public static final String EXTRA_SUPPLICANT_ERROR

Since: API Level 1

The lookup key for a SupplicantState describing the supplicant error code if any Retrieve with getIntExtra(String, int).

Constant Value: “supplicantError”

public static final String EXTRA_WIFI_STATE

Since: API Level 1

The lookup key for an int that indicates whether Wi-Fi is enabled, disabled, enabling, disabling, or unknown. Retrieve it withgetIntExtra(String, int).

Constant Value: “wifi_state”

public static final String NETWORK_IDS_CHANGED_ACTION

Since: API Level 1

The network IDs of the configured networks could have changed.

Constant Value: “android.net.wifi.NETWORK_IDS_CHANGED”

public static final String NETWORK_STATE_CHANGED_ACTION

Since: API Level 1

Broadcast intent action indicating that the state of Wi-Fi connectivity has changed. One extra provides the new state in the form of a NetworkInfo object. If the new state is CONNECTED, a second extra may provide the BSSID of the access point, as a String.

Constant Value: “android.net.wifi.STATE_CHANGE”

public static final String RSSI_CHANGED_ACTION

Since: API Level 1

The RSSI (signal strength) has changed.

See Also
Constant Value: “android.net.wifi.RSSI_CHANGED”

public static final String SCAN_RESULTS_AVAILABLE_ACTION

Since: API Level 1

An access point scan has completed, and results are available from the supplicant. Call getScanResults() to obtain the results.

Constant Value: “android.net.wifi.SCAN_RESULTS”

public static final String SUPPLICANT_CONNECTION_CHANGE_ACTION

Since: API Level 1

Broadcast intent action indicating that a connection to the supplicant has been established (and it is now possible to perform Wi-Fi operations) or the connection to the supplicant has been lost. One extra provides the connection state as a boolean, where true means CONNECTED.

Constant Value: “android.net.wifi.supplicant.CONNECTION_CHANGE”

public static final String SUPPLICANT_STATE_CHANGED_ACTION

Since: API Level 1

Broadcast intent action indicating that the state of establishing a connection to an access point has changed.One extra provides the new SupplicantState. Note that the supplicant state is Wi-Fi specific, and is not generally the most useful thing to look at if you are just interested in the overall state of connectivity.

Constant Value: “android.net.wifi.supplicant.STATE_CHANGE”

public static final int WIFI_MODE_FULL

Since: API Level 3

In this Wi-Fi lock mode, Wi-Fi will be kept active, and will behave normally, i.e., it will attempt to automatically establish a connection to a remembered access point that is within range, and will do periodic scans if there are remembered access points but none are in range.

Constant Value: 1 (0x00000001)

public static final int WIFI_MODE_SCAN_ONLY

Since: API Level 3

In this Wi-Fi lock mode, Wi-Fi will be kept active, but the only operation that will be supported is initiation of scans, and the subsequent reporting of scan results. No attempts will be made to automatically connect to remembered access points, nor will periodic scans be automatically performed looking for remembered access points. Scans must be explicitly requested by an application in this mode.

Constant Value: 2 (0x00000002)

public static final String WIFI_STATE_CHANGED_ACTION

Since: API Level 1

Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown. One extra provides this state as an int. Another extra provides the previous state, if available.

Constant Value: “android.net.wifi.WIFI_STATE_CHANGED”

public static final int WIFI_STATE_DISABLED

Since: API Level 1

Wi-Fi is disabled.

Constant Value: 1 (0x00000001)

public static final int WIFI_STATE_DISABLING

Since: API Level 1

Wi-Fi is currently being disabled. The state will change to WIFI_STATE_DISABLED if it finishes successfully.

Constant Value: 0 (0x00000000)

public static final int WIFI_STATE_ENABLED

Since: API Level 1

Wi-Fi is enabled.

Constant Value: 3 (0x00000003)

public static final int WIFI_STATE_ENABLING

Since: API Level 1

Wi-Fi is currently being enabled. The state will change to WIFI_STATE_ENABLED if it finishes successfully.

Constant Value: 2 (0x00000002)

public static final int WIFI_STATE_UNKNOWN

Since: API Level 1

Wi-Fi is in an unknown state. This state will occur when an error happens while enabling or disabling.

Constant Value: 4 (0x00000004)

Public Methods

public int addNetwork (WifiConfiguration config)

Since: API Level 1

Add a new network description to the set of configured networks. The networkId field of the supplied configuration object is ignored.

The new network will be marked DISABLED by default. To enable it, called enableNetwork(int, boolean).

Parameters
config the set of variables that describe the configuration, contained in a WifiConfiguration object.
Returns
  • the ID of the newly created network description. This is used in other operations to specified the network to be acted upon. Returns -1 on failure.

public static int calculateSignalLevel (int rssi, int numLevels)

Since: API Level 1

Calculates the level of the signal. This should be used any time a signal is being shown.

Parameters
rssi The power of the signal measured in RSSI.
numLevels The number of levels to consider in the calculated level.
Returns
  • A level of the signal, given in the range of 0 to numLevels-1 (both inclusive).

public static int compareSignalLevel (int rssiA, int rssiB)

Since: API Level 1

Compares two signal strengths.

Parameters
rssiA The power of the first signal measured in RSSI.
rssiB The power of the second signal measured in RSSI.
Returns
  • Returns <0 if the first signal is weaker than the second signal, 0 if the two signals have the same strength, and >0 if the first signal is stronger than the second signal.

public WifiManager.MulticastLock createMulticastLock (String tag)

Since: API Level 4

Create a new MulticastLock

Parameters
tag a tag for the MulticastLock to identify it in debugging messages. This string is never shown to the user under normal conditions, but should be descriptive enough to identify your application and the specific MulticastLock within it, if it holds multiple MulticastLocks.
Returns
  • a new, unacquired MulticastLock with the given tag.

public WifiManager.WifiLock createWifiLock (int lockType, String tag)

Since: API Level 3

Creates a new WifiLock.

Parameters
lockType the type of lock to create. See WIFI_MODE_FULL, and WIFI_MODE_SCAN_ONLY for descriptions of the types of Wi-Fi locks.
tag a tag for the WifiLock to identify it in debugging messages. This string is never shown to the user under normal conditions, but should be descriptive enough to identify your application and the specific WifiLock within it, if it holds multiple WifiLocks.
Returns
  • a new, unacquired WifiLock with the given tag.

public WifiManager.WifiLock createWifiLock (String tag)

Since: API Level 1

Creates a new WifiLock.

Parameters
tag a tag for the WifiLock to identify it in debugging messages. This string is never shown to the user under normal conditions, but should be descriptive enough to identify your application and the specific WifiLock within it, if it holds multiple WifiLocks.
Returns
  • a new, unacquired WifiLock with the given tag.

public boolean disableNetwork (int netId)

Since: API Level 1

Disable a configured network. The specified network will not be a candidate for associating. This may result in the asynchronous delivery of state change events.

Parameters
netId the ID of the network as returned by addNetwork(WifiConfiguration).
Returns
  • true if the operation succeeded

public boolean disconnect ()

Since: API Level 1

Disassociate from the currently active access point. This may result in the asynchronous delivery of state change events.

Returns
  • true if the operation succeeded

public boolean enableNetwork (int netId, boolean disableOthers)

Since: API Level 1

Allow a previously configured network to be associated with. If disableOthers is true, then all other configured networks are disabled, and an attempt to connect to the selected network is initiated. This may result in the asynchronous delivery of state change events.

Parameters
netId the ID of the network in the list of configured networks
disableOthers if true, disable all other networks. The way to select a particular network to connect to is specifytrue for this parameter.
Returns
  • true if the operation succeeded

public List<WifiConfiguration> getConfiguredNetworks ()

Since: API Level 1

Return a list of all the networks configured in the supplicant. Not all fields of WifiConfiguration are returned. Only the following fields are filled in:

  • networkId
  • SSID
  • BSSID
  • priority
  • allowedProtocols
  • allowedKeyManagement
  • allowedAuthAlgorithms
  • allowedPairwiseCiphers
  • allowedGroupCiphers
Returns
  • a list of network configurations in the form of a list of WifiConfiguration objects.

public WifiInfo getConnectionInfo ()

Since: API Level 1

Return dynamic information about the current Wi-Fi connection, if any is active.

Returns
  • the Wi-Fi information, contained in WifiInfo.

public DhcpInfo getDhcpInfo ()

Since: API Level 1

Return the DHCP-assigned addresses from the last successful DHCP request, if any.

Returns
  • the DHCP information

public List<ScanResult> getScanResults ()

Since: API Level 1

Return the results of the latest access point scan.

Returns
  • the list of access points found in the most recent scan.

public int getWifiState ()

Since: API Level 1

public boolean isWifiEnabled ()

Since: API Level 1

Return whether Wi-Fi is enabled or disabled.

Returns
  • true if Wi-Fi is enabled
See Also

public boolean pingSupplicant ()

Since: API Level 1

Check that the supplicant daemon is responding to requests.

Returns
  • true if we were able to communicate with the supplicant and it returned the expected response to the PING message.

public boolean reassociate ()

Since: API Level 1

Reconnect to the currently active access point, even if we are already connected. This may result in the asynchronous delivery of state change events.

Returns
  • true if the operation succeeded

public boolean reconnect ()

Since: API Level 1

Reconnect to the currently active access point, if we are currently disconnected. This may result in the asynchronous delivery of state change events.

Returns
  • true if the operation succeeded

public boolean removeNetwork (int netId)

Since: API Level 1

Remove the specified network from the list of configured networks. This may result in the asynchronous delivery of state change events.

Parameters
netId the integer that identifies the network configuration to the supplicant
Returns
  • true if the operation succeeded

public boolean saveConfiguration ()

Since: API Level 1

Tell the supplicant to persist the current list of configured networks.

Note: It is possible for this method to change the network IDs of existing networks. You should assume the network IDs can be different after calling this method.

Returns
  • true if the operation succeeded

public boolean setWifiEnabled (boolean enabled)

Since: API Level 1

Enable or disable Wi-Fi.

Parameters
enabled true to enable, false to disable.
Returns
  • true if the operation succeeds (or if the existing state is the same as the requested state).

public boolean startScan ()

Since: API Level 1

Request a scan for access points. Returns immediately. The availability of the results is made known later by means of an asynchronous event sent on completion of the scan.

Returns
  • true if the operation succeeded, i.e., the scan was initiated

public int updateNetwork (WifiConfiguration config)

Since: API Level 1

Update the network description of an existing configured network.

Parameters
config the set of variables that describe the configuration, contained in a WifiConfiguration object. It may be sparse, so that only the items that are being changed are non-null. The networkId field must be set to the ID of the existing network being updated.
Returns
  • Returns the networkId of the supplied WifiConfiguration on success.
    Returns -1 on failure, including when the networkId field of the WifiConfiguration does not refer to an existing network.
public class 

WifiManager.MulticastLock

extends Object

java.lang.Object
android.net.wifi.WifiManager.MulticastLock

Class Overview

Allows an application to receive Wifi Multicast packets. Normally the Wifi stack filters out packets not explicitly addressed to this device. Acquring a MulticastLock will cause the stack to receive packets addressed to multicast addresses. Processing these extra packets can cause a noticable battery drain and should be disabled when not needed.

Summary

Public Methods
void acquire() 

Locks Wifi Multicast on until release() is called.
boolean isHeld() 

Checks whether this MulticastLock is currently held.
void release() 

Unlocks Wifi Multicast, restoring the filter of packets not addressed specifically to this device and saving power.
void setReferenceCounted(boolean refCounted) 

Controls whether this is a reference-counted or non-reference- counted MulticastLock.
String toString() 

Returns a string containing a concise, human-readable description of this object.
Protected Methods
void finalize() 

Called before the object’s memory is reclaimed by the VM.
[Expand] 

Inherited Methods
From class java.lang.Object

Public Methods

public void acquire ()

Since: API Level 4

Locks Wifi Multicast on until release() is called. If this MulticastLock is reference-counted each call to acquire will increment the reference count, and the wifi interface will receive multicast packets as long as the reference count is above zero. If this MulticastLock is not reference-counted, the first call to acquire will turn on the multicast packets, but subsequent calls will be ignored. Only one call to release() will be required, regardless of the number of times thatacquire is called. Note that other applications may also lock Wifi Multicast on. Only they can relinquish their lock. Also note that applications cannot leave Multicast locked on. When an app exits or crashes, any Multicast locks will be released.

public boolean isHeld ()

Since: API Level 4

Checks whether this MulticastLock is currently held.

Returns
  • true if this MulticastLock is held, false otherwise

public void release ()

Since: API Level 4

Unlocks Wifi Multicast, restoring the filter of packets not addressed specifically to this device and saving power. If this MulticastLock is reference-counted, each call to release will decrement the reference count, and the multicast packets will only stop being received when the reference count reaches zero. If the reference count goes below zero (that is, if releaseis called a greater number of times than acquire()), an exception is thrown. If this MulticastLock is not reference-counted, the first call to release (after the radio was multicast locked using acquire()) will unlock the multicast, and subsequent calls will be ignored. Note that if any other Wifi Multicast Locks are still outstanding this release call will not have an immediate effect. Only when all applications have released all their Multicast Locks will the Multicast filter be turned back on. Also note that when an app exits or crashes all of its Multicast Locks will be automatically released.

public void setReferenceCounted (boolean refCounted)

Since: API Level 4

Controls whether this is a reference-counted or non-reference- counted MulticastLock. Reference-counted MulticastLocks keep track of the number of calls to acquire() and release(), and only stop the reception of multicast packets when every call to acquire() has been balanced with a call to release(). Non-reference- counted MulticastLocks allow the reception of multicast packets whenever acquire() is called and stop accepting multicast packets whenever release()is called.

Parameters
refCounted true if this MulticastLock should keep a reference count

public String toString ()

Since: API Level 4

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object’s type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

Protected Methods

protected void finalize ()

Since: API Level 4

Called before the object’s memory is reclaimed by the VM. This can only happen once the garbage collector has detected that the object is no longer reachable by any thread of the running application.

The method can be used to free system resources or perform other cleanup before the object is garbage collected. The default implementation of the method is empty, which is also expected by the VM, but subclasses can overridefinalize() as required. Uncaught exceptions which are thrown during the execution of this method cause it to terminate immediately but are otherwise ignored.

Note that the VM does guarantee that finalize() is called at most once for any object, but it doesn’t guarantee when (if at all) finalize() will be called. For example, object B’s finalize() can delay the execution of object A’s finalize()method and therefore it can delay the reclamation of A’s memory. To be safe, use a ReferenceQueue, because it provides more control over the way the VM deals with references during garbage collection.

Throws
Throwable
public class 

WifiManager.WifiLock

extends Object

java.lang.Object
android.net.wifi.WifiManager.WifiLock

Class Overview

Allows an application to keep the Wi-Fi radio awake. Normally the Wi-Fi radio may turn off when the user has not used the device in a while. Acquiring a WifiLock will keep the radio on until the lock is released. Multiple applications may hold WifiLocks, and the radio will only be allowed to turn off when no WifiLocks are held in any application. Before using a WifiLock, consider carefully if your application requires Wi-Fi access, or could function over a mobile network, if available. A program that needs to download large files should hold a WifiLock to ensure that the download will complete, but a program whose network usage is occasional or low-bandwidth should not hold a WifiLock to avoid adversely affecting battery life. Note that WifiLocks cannot override the user-level “Wi-Fi Enabled” setting, nor Airplane Mode. They simply keep the radio from turning off when Wi-Fi is already on but the device is idle.

Summary

Public Methods
void acquire() 

Locks the Wi-Fi radio on until release() is called.
boolean isHeld() 

Checks whether this WifiLock is currently held.
void release() 

Unlocks the Wi-Fi radio, allowing it to turn off when the device is idle.
void setReferenceCounted(boolean refCounted) 

Controls whether this is a reference-counted or non-reference-counted WifiLock.
void setWorkSource(WorkSource ws)
String toString() 

Returns a string containing a concise, human-readable description of this object.
Protected Methods
void finalize() 

Called before the object’s memory is reclaimed by the VM.
[Expand] 

Inherited Methods
From class java.lang.Object

Public Methods

public void acquire ()

Since: API Level 1

Locks the Wi-Fi radio on until release() is called. If this WifiLock is reference-counted, each call to acquire will increment the reference count, and the radio will remain locked as long as the reference count is above zero. If this WifiLock is not reference-counted, the first call to acquire will lock the radio, but subsequent calls will be ignored. Only one call torelease() will be required, regardless of the number of times that acquire is called.

public boolean isHeld ()

Since: API Level 1

Checks whether this WifiLock is currently held.

Returns
  • true if this WifiLock is held, false otherwise

public void release ()

Since: API Level 1

Unlocks the Wi-Fi radio, allowing it to turn off when the device is idle. If this WifiLock is reference-counted, each call torelease will decrement the reference count, and the radio will be unlocked only when the reference count reaches zero. If the reference count goes below zero (that is, if release is called a greater number of times than acquire()), an exception is thrown. If this WifiLock is not reference-counted, the first call to release (after the radio was locked using acquire()) will unlock the radio, and subsequent calls will be ignored.

public void setReferenceCounted (boolean refCounted)

Since: API Level 1

Controls whether this is a reference-counted or non-reference-counted WifiLock. Reference-counted WifiLocks keep track of the number of calls to acquire() and release(), and only allow the radio to sleep when every call to acquire() has been balanced with a call to release(). Non-reference-counted WifiLocks lock the radio whenever acquire() is called and it is unlocked, and unlock the radio whenever release() is called and it is locked.

Parameters
refCounted true if this WifiLock should keep a reference count

public void setWorkSource (WorkSource ws)

Since: API Level 9

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object’s type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

Protected Methods

protected void finalize ()

Since: API Level 1

Called before the object’s memory is reclaimed by the VM. This can only happen once the garbage collector has detected that the object is no longer reachable by any thread of the running application.

The method can be used to free system resources or perform other cleanup before the object is garbage collected. The default implementation of the method is empty, which is also expected by the VM, but subclasses can overridefinalize() as required. Uncaught exceptions which are thrown during the execution of this method cause it to terminate immediately but are otherwise ignored.

Note that the VM does guarantee that finalize() is called at most once for any object, but it doesn’t guarantee when (if at all) finalize() will be called. For example, object B’s finalize() can delay the execution of object A’s finalize()method and therefore it can delay the reclamation of A’s memory. To be safe, use a ReferenceQueue, because it provides more control over the way the VM deals with references during garbage collection.

Throws
Throwable
Reference

Wifi Agent

Posted: January 20, 2011 in WiFi
Rating:
Price:
Free
Version:
1.51
Updated:
September 03, 2010
Publisher:
BITS Android Team
File size:
1.95 MB
Downloads:
10000-50000

Download Wifi Agent Download

A war-driving app for android: 

• Find networks in your area
• View access points on a map
• Log all access points encountered
• Stores logs as KML file for Google Earth
• Send KML files via email
• Animated KML files allow you to view access points temporally
• Uses triangulate to get actual location of AP

Package: bitsys.androidteam

Tags: android agent wifi, wifi agent, wifi agent download, kml triangulate, agent wifi android, …

Wifi Agent Screenshots

Wifi Agent for Android screenshot Wifi Agent for Android screenshot

http://www.androidzoom.com/android_applications/tools/wifi-agent_katx.html