title: Android Send data in the background when connected
body: <p>Basicly I need that my app sends some data to a server when the connection to the network is established and it has to be in the background. That's it.</p>
  
  <p>Is there a way that my service is automaticly started when connection is made?  Or should I use regular Service which tests the connection and run this service in something like 30min intervals? Should I use something like the AlarmManager to check for the connection? This seems as a waste of the resources and as far as I'm aware Android can stop services if resources are needed.</p>
  
  <p>Any suggestions or even better - samples on what is the optimal way?</p>
  
  <p>Thank you.</p>