Four categories of WiFi developed by Android

Source: Internet
Author: User
Tags get ip bssid

Four categories of WiFi developed by Android

In Android for WiFi operation, Android itself offers some useful packages under the Android.net.wifi package. To introduce:
Can be broadly divided into four basic classes Scanresult,wificonfiguration,wifiinfo,wifimanager
(1) Scanresult, WiFi hardware scan to get the surrounding WiFi hotspot.
(2) wificonfiguration connected WiFi access point need to obtain information.
(3) Wifiinfo:
WiFi connectivity later. The ability to obtain information about the current link through this class of access to some connected WiFi connections, by:
Getbssid () Get Bssid
Getdetailedstateof () Get the connectivity of the client
Gethiddenssid () gets whether the SSID is hidden
Getipaddress () Get IP address
Getlinkspeed () Get the speed of the connection
Getmacaddress () Get MAC Address
Getrssi () Get signal from 802.11n network
Getssid () Get SSID
Getsupplicanstate () returns information about the client state in detail
(4) Wifimanager: Manage WiFi connection. There are many constants defined in this class that can be used directly without having to create them again:

String Action_pick_wifi_networkActivity action: Select a WiFi network connection.
Int Error_authenticatingA validation error issue has occurred.
String Extra_bssidThe string provides the bssid of the access point.
String Extra_network_infoFederated Network Information.
String Extra_new_rssiProvides a new Rssi (signal strength).
String Extra_new_stateView the new request status.
String Extra_previous_wifi_stateThe status of the current Wi-Fi.
String extra_supplicant_connectedIndicates that the connection to the app daemon has been acquired or lost.
String Extra_supplicant_errorThis error occurs when an error in Getintextra (String, int) is called.
String Extra_wifi_infoProvides information on the connected access point.


String Extra_wifi_stateAn additional integer keyword can be used to indicate whether Wi-Fi is enabled, disabled, enabled, disabled, or unknown.
String Network_ids_changed_actionThe configured network identity has been changed.
String Network_state_changed_actionThe configured network state has been changed.
String Rssi_changed_actionRSSI (signal strength) has changed.
String Scan_results_available_actionThe access point is scanned and the results are available. Can call Getscanresults () to get the result.
String Supplicant_connection_change_actionThe broadcast behavior indicates that the connection has been established or lost.
String Supplicant_state_changed_actionThe state of requesting an access point connection has changed.
Int Wifi_mode_fullIn this lockdown mode, Wi-Fi stays active. Actively attempt to connect within the range, already configured access points.

At the same time, a non-configured access point was found.
int Wifi_mode_full_high_perf in such a lock mode, Wi-Fi will remain and wifi_mode_full the same activation state. The difference is that when the screen device is turned off, the minimum packet loss and the minimum time-delay high-power connection are maintained. The pattern should therefore be used as far as possible without unnecessary circumstances.
int wifi_mode_scan_only in this lock mode, Wi-Fi will stay active.

However, only the scan within the access range can be performed. It does not actively connect to an already configured access point and does not actively scan itself. Need to apply a clear start scan operation.
String Wifi_state_changed_actionBroadcast behavior is expressed. The current Wi-Fi status may be: Enabled, disabled, enabled, disabled.
Int Wifi_state_disabledWi-Fi is disabled.
Int Wifi_state_disablingWi-Fi started disabling, assuming the operation was successful and the status is wifi_state_enabled
Int Wifi_state_enabledWi-Fi is already enabled.
Int Wifi_state_enablingWi-Fi is enabled, assuming success with a status of Wifi_state_enabled.
Int Wifi_state_unknownWi-Fi unknown status. An error is caused when the enable or disable process occurs.
Method:
Public Methods
Int Addnetwork (wificonfiguration config)
Join a new network.
static int Calculatesignallevel (int rssi, int numlevels)
Calculates the signal level.
static int Comparesignallevel (int rssia, int rssib)
Compare the signal strength of A and B.
Wifimanager.multicastlock Createmulticastlock (String tag)
Create a multipoint transfer lock.
Wifimanager.wifilock Createwifilock (int lockType, String tag)
Create a new WiFi lock.
Wifimanager.wifilock Createwifilock (String tag)
Create a new WiFi lock. The number of parameters marked with the tag.
Boolean disablenetwork (int netId)
Disable a network that is configured well.
Boolean Disconnect ()
Cancels the connection to the current access point.
Boolean Enablenetwork (int netId, Boolean disableothers)
Agree that the currently configured network can be connected.
List<wificonfiguration> Getconfigurednetworks ()
Returns a list of all configurable networks.
Wifiinfo Getconnectioninfo ()
If there is an action, return the dynamic information of the current WiFi connection.
Dhcpinfo Getdhcpinfo ()
Return the dhcp-assigned addresses from the last successful a DHCP request, if any.
List<scanresult> Getscanresults ()
Returns the list of scanned networks.
Int Getwifistate ()
Get WiFi status.
Boolean Iswifienabled ()
Return WiFi available or not available.
Boolean Pingsupplicant ()
Check The supplicant daemon is responding to requests.
Boolean Reassociate ()
Connects to the current access point again, regardless of whether it is connected.
Boolean Reconnect ()
Assuming the current network connection is lost, connect to the current access point again.
Boolean removenetwork (int netId)
Removed from the list of configurable networks.
Boolean Saveconfiguration ()
Saves the list of currently configurable networks.
Boolean Setwifienabled (Boolean enabled)
Enable or disable WiFi.
Boolean Startscan ()
Requests a scan of the access point.
Int Updatenetwork (wificonfiguration config)
Update the network or end a configured network.


Four categories of WiFi developed by Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.