title: Running BLE in background on Android
body: <h2>Where I'm Currently At:</h2>
  <p>I would like to be able to run Bluetooth in my app in the background on android. I have read various guides and understand the idea of creating an intent service (something like <code>android.app.IntentService</code> and extending it, overwriting the <code>onHandleIntent</code> with your desired behaviour) however, I don't understand how that would interract with my existing behaviour? So for example, I currently call:</p>
  <pre><code>...
  var bluetoothManager = utils.ad.getApplicationContext().getSystemService(android.content.Context.BLUETOOTH_SERVICE);
  adapter = bluetoothManager.getAdapter();
  adapter.startLeScan(Bluetooth._scanCallback)
  ...
  </code></pre>
  <p>(this is in JavaScript, using the nativescript runtime, so don't worry about it looking a bit wierd.)</p>
  <h2>Where I'm trying to get to:</h2>
  <p>I would like to being able to scan for and reconnect to paired devices in the background and recieve (store in SQLite) GATT Characteristic updates.</p>
  <h2>Question:</h2>
  <p>So how do I create this functionality in the type of service that can be run in the background as described above?</p>