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.
I need to send data all the time even if the activity is in background.
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.
EDIT:
I got this error using the below 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
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.