title: Send data to server from android device when app gets in background
body: <p>Currently i can only send the data to the server when my app (activity) is in foreground. This happens at least in 4.1.3 because the android SO pauses the app or stops it.</p>
  
  <p>I need to send data all the time even if the activity is in background.</p>
  
  <p>What is the best way of achieving this. Asynctask is not a good answer because i want to send data periodically. Not once. I already use asynctasks as a way to send the data to the server what i need is something that runs together with the activity but doesn't get stopped by the SO.</p>
  
  <p>EDIT:</p>
  
  <p>I got this error using the below code.</p>
  
  <pre><code>04-03 13:55:28.804: E/AndroidRuntime(1165): java.lang.RuntimeException: Unable to instantiate receiver main.inSituApp.BootCompletedIntentReceiver: java.lang.ClassNotFoundException: main.inSituApp.BootCompletedIntentReceiver
  </code></pre>
  
  <p>Can anyone tell me what that error means? i dont have a class with that receiver but i though if i register it in the manifest i wouldn't need it.</p>