You should use Service class, this class is intented to do long task not linked to any activity life cycle, Service has its own life cycle, and you definitely must use it if you want a long task to remain active even when non of your activities is actually visible, please refer to: http://developer.android.com/reference/android/app/Service.html for more information about services. This is one of the main building components in android and a good understanding of them is a MUST...
Hope this helps.
Regards!