Look at the note in description of getRunningTasks, basically it says app core logic shouldn't depend on it.
http://developer.android.com/reference/android/app/ActivityManager.html#getRunningTasks(int)
Check this solution:
http://stackoverflow.com/questions/3667022/android-is-application-running-in-background