Added calls to pause and unpause the thread when the activity pauses and resumes. The thread was previously not pausing when the screen was locked.