Let's start with the desire to run even the app was killed.
I assume you mean when the app is killed by the user. The system could also kill the app, for example if it needs resources that your app is using in the background.
If the system kills the app, you can continue working with Bluetooth devices. But if the user kills it, then the app will not function until it is manually launched again. User killing the app is considered a drastic choice by the user to say that they do not want the app to run, often because it misbehaved in some unrecoverable manner. Our recommendation would be to respect the users' choice on that matter and not try to find ways around this.
As for starting a scan every 5 seconds, this is not how Bluetooth works. My recommendation would be to read up on BLE scanning and connecting process, and also read Core Bluetooth Background Processing for iOS Apps to understand how you can implement what you need to do using the Core Bluetooth framework.
Argun Tekant /
DTS Engineer /
Core Technologies