Class AndroidBluetoothDeviceProximityProbe
Scans for the presence of other devices nearby that are running the current Protocol. When encountered, this Probe will read the device ID of other devices. This Probe also advertises the presence of the current device and serves requests for the current device's ID. This Probe reports data in the form of BluetoothDeviceProximityDatum objects.
There are caveats to the conditions under which an Android device running this Probe will detect another device:
- If the other device is an Android device with Sensus running in the foreground or background, detection is possible.
- If the other device is an iOS device with Sensus running in the foreground, detection is possible.
- If the other device is an iOS device with Sensus running in the background, detection is not possible.
NOTE: The value of Id running on the other device must equal the value of Id running on the current device. When a Protocol is created from within the Sensus app, it is assigned a unique identifier. This value is maintained or changed depending on what you do:
When the newly created Protocol is copied on the current device, a new unique identifier is assigned to it. This breaks the connection between the Protocols.
When the newly created Protocol is shared via the app with another device, its identifier remains unchanged. This maintains the connection between the Protocols.
Thus, in order for this AndroidBluetoothDeviceProximityProbe to operate properly, you must configure your Protocols in one of the two following ways:
Create your Protocol on one platform (either Android or iOS) and then share it with a device from the other platform for customization. The Id values of these Protocols will remain equal and this AndroidBluetoothDeviceProximityProbe will detect encounters across platforms.
Create your Protocols separately on each platform and then set the Id field on one platform (using the "Set Study Identifier" button) to match the Id value of the other platform (obtained via "Copy Study Identifier").
See the iOS subclass of BluetoothDeviceProximityProbe for additional information.
Inheritance
Inherited Members
Namespace: Sensus.Android.Probes.Context
Assembly: SensusAndroid.dll
Syntax
public class AndroidBluetoothDeviceProximityProbe : BluetoothDeviceProximityProbe, INotifyPropertyChanged, IPollingProbe, IProbe
Constructors
AndroidBluetoothDeviceProximityProbe()
Declaration
public AndroidBluetoothDeviceProximityProbe()
Properties
DefaultPollingSleepDurationMS
Declaration
public override int DefaultPollingSleepDurationMS { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
Methods
InitializeAsync()
Declaration
protected override Task InitializeAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
ReadPeripheralCharacteristicValuesAsync(CancellationToken)
Declaration
protected override Task<List<Tuple<string, DateTimeOffset>>> ReadPeripheralCharacteristicValuesAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<System.Tuple<System.String, System.DateTimeOffset>>> |
Overrides
ScanAsync(CancellationToken)
Declaration
protected override Task ScanAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
StartAdvertising()
Declaration
protected override void StartAdvertising()
Overrides
StopAdvertising()
Declaration
protected override void StopAdvertising()
Overrides
TestHealthAsync(List<AnalyticsTrackedEvent>)
Declaration
public override Task<HealthTestResult> TestHealthAsync(List<AnalyticsTrackedEvent> events)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AnalyticsTrackedEvent> | events |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<HealthTestResult> |