ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Bluetooth
  • Visible radio and connection request
  • Required permissions
  • Limitation
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
BTChangeVisibility (Function)
In french: BTChangeVisibilité
Changes the visibility of a Bluetooth radio.
Note: A Bluetooth radio corresponds to a Bluetooth transmitter.. This transmitter can correspond to a Bluetooth USB key or it can be an element included in a computer (laptop for example).
Android Caution: Bluetooth functions are not available in the Android emulator.
Example
Reports and QueriesWindowsUser code (UMC)Ajax
bVisible is boolean
// Identifiant des radios Bluetooth listés dans un champ Table 
nIdRadio is int
nIdRadio = TABLE_Radios.COL_ID[TABLE_Radios]
// Teste si la radio sélectionnée est visible
bVisible = BTIsVisible(nIdRadio)
// Affichage 
IF bVisible = True THEN
	Trace("Visible")
ELSE 
	Trace("Non visible")
END
// Changement de la visibilité
BTChangeVisibility(nIdRadio, NOT bVisible)
Syntax
Reports and QueriesWindowsUser code (UMC)Ajax

Syntax that can be used in Windows Hide the details

<Result> = BTChangeVisibility(<Radio identifier> , <New status>)
<Result>: Boolean
  • True if the change of visibility was successfully performed,
  • False otherwise. ErrorInfo returns more information on the error.
<Radio identifier>: Integer
Identifier of Bluetooth radio to use. This identifier is returned by BTListRadio.
<New status>: Boolean
  • True in order for the radio to become visible,
  • False in order for the radio to be hidden.
Android

Syntax that can be used in Android Hide the details

<Result> = BTChangeVisibility(<New status> [, <Duration>])
<Result>: Boolean
  • True if the change of visibility was successfully performed,
  • False otherwise. ErrorInfo returns more information on the error.
<New status>: Boolean
  • True in order for the radio to become visible,
  • False in order for the radio to be hidden.
Android The visibility cannot be disabled programmatically. This deactivation is temporary.
<Duration>: Optional integer or optional Duration
Duration (in seconds) during which the device must be made visible. This parameter must be included between 1 and 300 seconds. By default, the visibility duration is set to 120 seconds.
This parameter can correspond to:
  • an integer corresponding to the number of seconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s).
Remarks

Visible radio and connection request

A visible Bluetooth radio automatically accepts the connection requests. When BTChangeVisibility is used to make the radio visible, the call to BTChangeConnectivity is automatically performed.
Android In Android, the visibility of the device in relation to the other Bluetooth devices is always temporary (up to 5 minutes). If BTChangeVisibility is used to make the device visible, a system dialog box will be displayed to ask for user confirmation.
Note: This dialog box is imposed by the Android system and cannot be avoided.
Android confirmation box
Android

Required permissions

This function changes the permissions required by the application.
Permission required: BLUETOOTH.
This permission allows the applications to connect to the Bluetooth services.
Windows

Limitation

Only the Microsoft Bluetooth stack is supported by this function. To know the stack used, call BTStack.
For more details, see Which stacks to use?
Android

Application in the background: Specific case from Android 10

Starting with Android 10, it is no longer possible to open a window when the application is in the background.
BTChangeVisibility can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Component: wd300com.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help