The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach. |
Description
Specifies whether Bluetooth is enabled on the mobile device.
Declaration
ProgObj.BluetoothEnabled
Read-Write Property | Boolean |
ProgObj | An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section |
Applies To
The property is applied to the following object:
Property Value
True if Bluetooth is enabled, and False otherwise.
Example
The following example checks if Bluetooth is enabled on the device and posts this information to the log.
JavaScript, JScript
function Test()
{
Mobile.SetCurrent("MyDevice")
if (Mobile.Device().Connections.BluetoothEnabled)
Log.Message("Bluetooth is enabled")
else
Log.Message("Bluetooth is disabled")
}
Python
def Test():
Mobile.SetCurrent("MyDevice")
if Mobile.Device().Connections.BluetoothEnabled:
Log.Message('Bluetooth is enabled')
else:
Log.Message('Bluetooth is disabled')
VBScript
Sub Test()
Mobile.SetCurrent("MyDevice")
If Mobile.Device.Connections.BluetoothEnabled Then
Log.Message("Bluetooth is enabled")
Else
Log.Message("Bluetooth is disabled")
End If
End Sub
DelphiScript
procedure Test();
begin
Mobile.SetCurrent('MyDevice');
if Mobile.Device.Connections.BluetoothEnabled then
Log.Message('Bluetooth is enabled')
else
Log.Message('Bluetooth is disabled')
end;
C++Script, C#Script
function Test()
{
Mobile["SetCurrent"]("MyDevice")
if (Mobile["Device"].Connections["BluetoothEnabled"])
Log["Message"]("Bluetooth is enabled")
else
Log["Message"]("Bluetooth is disabled")
}
See Also
Testing Android Applications (Legacy)
AndroidConnections Object
Working With Android Device Settings During Test Run (Legacy)