If I connect to a Bluetooth Low Energy device on and Android device, and then destroy (i.e. hit Back and then see the OnDestroy callback get hit) the app with which I called BluetoothDevice.ConnectGatt(), the connection does not actually get dropped, though the UI does start over if the app is restarted. What part of the app stays alive after it is supposed to have been destroyed, and is it possible to re-access it instead of re-creating it?
This is not a question about not knowing how to use Android's BLE APIs. I can disconnect programatically just fine. The connection does get dropped when the app is "really killed", i.e. swiped off of the Overview, so there is apparently some difference between destroyed and "dead" states and that is what I want to know about. BLE is just the avenue that I've used to discover this lifecycle behavior. For all I know, this behavior may be reproducible with other peripherals such as GPS.
The plugin I'm using for the BLE functionality does not appear to be creating a Service to maintain any background work, which is the only method I know of to keep stuff going after an app is destroyed.
(EDIT Re. possible duplicate: In addition to my clarifications above, I do not use the socket or stream APIs that were giving that other user trouble. This is BT Low Energy, not BT Classic.)
(EDIT: Emil makes a good point, so I removed the mention of BLE from the question title)
I've seen this with both a Samsung Galaxy S7 with Android 7 and an LG Nexus 5 with Android 6.