title: How to keep bluetooth connection in background?
body: <p>i am writing a bluetooth app communicating with a bluetooth module. Actually it works very well. But i want the connection to stay established also while the app is in background and other apps are used, so that another activity like incoming sms or something else can trigger my app in background to send messages to my device.</p>
  
  <p>Until now i am very confused how to do this. Can anyone give me advice?</p>
  
  <p>I also checked this: <a href="https://stackoverflow.com/questions/19169539/background-bluetooth-app-threading">Background Bluetooth App - Threading?</a> but it doesn't help me.</p>
  
  <p>Here is my code so far:
  <a href="http://pastebin.com/C7Uynuan" rel="noreferrer">http://pastebin.com/C7Uynuan</a></p>
  
  <p>Side information: there is a connect button, which establishs the connection and then there are 3 other buttons sending different messages to my device.
  In OnResume i reconnect to my device, but this should be not necessary when having a stable connection.</p>
  
  <p>Thanks,</p>
  
  <p>progNewfag</p>
  
  <p>EDIT: Now i am pretty sure that i need to use an IntentService, but not sure how.</p>