ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / WiFi functions
  • Special cases
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
WiFiDetectAccessPoint (Function)
In french: WiFiDétectePointAccès
Starts detecting the Wi-Fi access points currently accessible from the device.
AndroidAndroid Widget Remarks:
  • To add the network associated with an access point to the list of networks configured on the device, use WiFiAddNetwork.
  • The Wi-Fi access is not available in the Android emulator.
Example
NextTitle("Détection des points d'accès Wi-Fi")
ListePoint is string
sSSID is string
sBSSID is string 
ListePoint = WiFiDetectAccessPoint()
FOR EACH STRING PointAcces OF ListePoint SEPARATED BY CR
	sSSID = ExtractString(PointAcces, 2, TAB)
	sBSSID = ExtractString(PointAcces, 3, TAB)
	...
END
Syntax
<Result> = WiFiDetectAccessPoint([<Timeout>])
<Result>: Character string
  • List of detected Wi-Fi access points separated by CR characters (Carriage Return),
  • Empty string ("") if no Wi-Fi access point was detected. The ErrorOccurred variable is used to find out whether an error occurred while detecting the access points. ErrorInfo returns more information on the error.
For each network, a set of information is returned in the following format:
<Identifier> + TAB + <SSID> + TAB + <BSSID> +
TAB + <Security> + TAB + <Signal strength>
where:
  • <Identifiant>: Network identifier associated with the access point, empty string ("") if the access point does not correspond to any network configured on the device.
  • <SSID>: SSID (Service Set Identifier) of the Wi-Fi network associated with the access point.
  • <BSSID>: BSSID (Basic Service Set Identifier) of the access point
  • <Sécurité> Type of security used by the Wi-Fi network:
    wifiSecurityIEEE8021XSecurity that uses the IEEE 802.1x standard.
    wifiSecurityNoneNo security is used.
    wifiSecurityWEPSecurity based on a WEP key (Wired Equivalent Privacy)
    wifiSecurityWPA2Security that uses the WPA2 mechanism (Wi-Fi Protected Access).
    wifiSecurityWPASecurity that uses the WPA mechanism (Wi-Fi Protected Access).
    wifiSecurityWPA_EAPSecurity that uses the WPA mechanism (Wi-Fi Protected Access) and the EAP mechanism (Extensible Authentication Protocol).
  • <Puissance du signal> Signal strength expressed in dBm (decibel per milliwatt).
<Timeout>: Optional integer or optional Duration
Maximum duration of detection in hundredths of a second.
  • An error occurs if this timeout is reached before the end of detection.
  • If this timeout is not specified or is set to 0, no time limit will be applied.
This parameter can correspond to:
  • an integer corresponding to the number of hundredths of a second,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
Remarks

Special cases

  • The list of access points returned by WiFiDetectAccessPoint is sorted by order of signal strength (from the strongest signal to the weakest).
  • AndroidAndroid Widget If the function is run by the main thread of the application, an hourglass (infinite progress bar) will be displayed during the detection of access points. To specify the message that will be displayed in the hourglass, use NextTitle before the call to WiFiDetectAccessPoint.
  • From Android 6.0 Location must be enabled on device. Otherwise, the function will return an empty list. GPSStatus is used to find out whether the location is enabled or not.
AndroidAndroid Widget

Required permissions

This function changes the permissions required by the application.
Required permissions:
  • ACCESS_WIFI_STATE: enables applications to access information about Wi-Fi networks.
  • CHANGE_WIFI_STATE: Allows applications to change Wi-Fi connectivity status.
Android 11 specific case: This function requires the ACCESS_BACKGROUND_LOCATION permission to access the device's location.
This permission allows using the function when the application is in the background.
If the application needs to use background location:
  • Manually add the "ACCESS_BACKGROUND_LOCATION" permission in the Android application generation wizard.
  • Explicitly request background location permission with PermissionRequest. For example:
    PermissionRequest(permBackgroundLocation, Callback)
    INTERNAL PROCEDURE Callback(p is Permission)
    	IF p.Accordé THEN
    		// Utilisation possible des fonctions nécessitant la localisation en arrière-plan
    	END
    END
A window allows users to:
  • allow access to the device location while the application is in the background,
  • allow access to the location only while the application is in use,
  • deny access to the location. The user can also change these permissions at any time in the Android settings.

Remarks:
  • Follow Google's guidelines for applications that require background location access. For more details, see https://support.google.com/googleplay/android-developer/answer/9799150. If these conditions are not met (especially user information requirements), applications may not be accepted for publication on Google Play.
  • The background location permission should only be requested if the location permission has been granted. Otherwise, PermissionRequest will fail.
  • If the option chosen by the user for the background location access request is more restrictive than the option chosen for the location access request, the application will be automatically restarted.
  • On devices running Android 10 or earlier, if location permission has been granted to the application, the background location permission will be granted without displaying a window.
Related Examples:
WM System Cross-platform examples (WINDEV Mobile): WM System
[ + ] This application is an example of some of the features of WINDEV Mobile available for Android/iOS.
The following system functions are used:
- NFC
- Multimedia control
- Brightness
- Volume
- Wi-Fi
- Bluetooth
- Toast
- Compass
- Accelerometer
- Camera control
- LED
- Vibration
- Notifications
- Drawing functions
- Internet
Component: wd300com.dll
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help