Skip to content

Best Practices

Best Practices

When using observables within BluetoothLE, you should always use .Timeout(TimeSpan.FromSeconds(X)) to kill tasks that take too long. Android tends to hang on certain calls if a connection is broken during certain operations.

General Rules

While this library tries to deal with all of the known Android issues to the best of its ability. You likely will encounter issues if you don’t follow the below:

  1. DO NOT hold a reference to an IPeripheral across scans UNLESS it is connected
  2. Don’t scan or do anything with the adapter while connected to the GATT
  3. Don’t overwhelm the radio. The library now has an internal queue to force operations to finish.
  4. GATT 133 will happen on Connect on occasion. Catch exceptions in the observable subscriptions.
  5. Bluetooth LE IS NOT GOOD for large payloads or things like JSON - keep it small and simple
  6. Scan for devices YOU work with. In most apps, you will almost always be scanning with a Service UUID
  7. Do NOT discover all services & characteristics. There is a performance cost with doing this. You are always best to work with the service/characteristics known to you

FAQ