-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
I'm developing an app that interfaces with BLE devices.
Inside the app I can pair the devices and monitor their status.
If I close the app I want to disconnect the devices from the smartphone, and when I open it again, I want the app to reconnect automatically to known devices.
Everything works fine without using the background plugin, but I need to use it since the app needs to monitor the BLE devices even when it's in background.
The problem happens ONLY if I use the background plugin: if I open again the app, the known devices are not reconnected INSIDE the app, but it appears they are already/still connected to the smartphone from the previous time (even if not shown in the bluetooth devices in the phone settings).
It seems that the bluetooth connection to known devices isn't really being closed when I kill the app.
It appears like the device is still connected as therefore it doesn't show up when I scan in the app.
I can't reconnect until I close the app, switch off and then on again bluetooth, and reopen the app.
The steps are very simples:
- I open and connect the first time from the phone to the BLE product
- Communication is OK, data is sent and received
- I close (kill) the application from the smartphone (Without turning off Bluetooth/BLE from smartphone)
- I relaunch the application ---> Known device is not reconnected, but appears to be somehow still paired with the phone (if I press the pairing button it does not go into pairing mode, that happens if it is already bonded to a phone).
Why this behaviour? Looks like something in the plugin prevents the bluetooth connection to be closed on app closing. I specify that:
- it only occurs using the background plugin, without it activated everything works ok
- this behaviour occurs only with Android (don't use the background plugin for iOS)
- It does happen only on some Android smartphones: tried three different phones, with Adroid version v4.4, v5.1.1 and v6.0.1, and only two of them show this issue (android version 4.4 on S3 and 6.0.1 on S5 Neo).
Thanks