Skip to content

Note

We're sorry, this article hasn't been completed or updated yet. We're working on finishing it as soon as possible. In case of any questions, please reach out to our Support Team.

Best Practices

UI Thread Interaction

Any scanning results (onDiscovered, onUpdated, onLost) will be reported on the same thread that scanning has been initialized on.

Before interaction with UI thread of your app you should check which thread you are running and redirect to UI thread.

Reducing UI operations (Device Update Callback Interval)

The device update callback interval prevents the update events from being called instantly.

Once the Android device enters a space with many BLE devices the update events start to be called with instantly growing number of updated BLE devices. This may cause interruptions when interacting with UI. The device update callback interval causes the update events to be called periodically.

The following snippet presents how to set the interval to 5 seconds.

proximityManager.configuration()
    .deviceUpdateCallbackInterval(TimeUnit.SECONDS.toMillis(5))
    .apply();

Device update callback is set to 3 seconds by default.

ProximityManager reusing

ProximityManager is regular Java Object and we are giving you freedom of usage.

However, we recommend to use it as singleton in your application. We don't want to push you with our singleton implementation, so you can use your favourite approach, but we do encourage using some kind of dependency injection container like Dagger.