Search code examples
androidbluetooth-lowenergygatt

Prevent connection of BLE device to GATT server


Third party BLE device has attempt to connect to my GATT server, the result is that device become inaccessible for his native app. My wild guess is I should prevent connection of that device to my GATT server, but I don't know how to do that. Any suggestion? Thanx


Solution

  • The decision was not so trivial: it is necessary to clear any links to previously discovered (scanned) BLE devices by onLeScan when app goes to background (onPause received, but still not onDestroy). If you still keeping these links, you'll unable to connect to those devices from other app.