Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine Reason for Android Pause

My application is randomly pausing (going into the onPause method) then resuming (going into the onResume method) when I'm not even touching the screen. In logcat, there is no indication what is causing the pause and resume. This only happens on a Galaxy Tab 7" and not on a Motorola Xoom or HTC Legend.

How can I determine the reason for a pause?

like image 495
Amandeep Grewal Avatar asked Jul 18 '11 15:07

Amandeep Grewal


People also ask

Why does the foreground activity pause during normal app use?

During normal app use, the foreground activity is sometimes obstructed by other visual components that cause the activity to pause. For example, when a semi-transparent activity opens (such as one in the style of a dialog), the previous activity pauses.

What happens when I pause an activity?

As your activity enters the paused state, the system calls the onPause () method on your Activity, which allows you to stop ongoing actions that should not continue while paused (such as a video) or persist any information that should be permanently saved in case the user continues to leave your app.

How to pause a number on an Android phone?

When you tap the Phone icon to dial a number on your Android phone, the number is instantly spewed into the phone system, like water out of a hose. If you need to pause the number as it’s dialed, you need to know how to insert secret pause characters.

What is onpause () method in Android activity life cycle?

onPause() Method In Android Activity Life Cycle: When Activity is in background then onPause() method will execute. Activity is not visible to user and goes in background when onPause() method is executed.


1 Answers

You stated that it only happens only on the Galaxy Tab. I would hypothesize there is another app running on the device that frequently adds an invisible overlay. If this overlay is on the foreground, it would trigger the onPause() in your app.

You can use Android Instrumentation to monitor Activity launches by the use of ActivityMonitor. I believe you can even use it to prevent certain Activity from launching.

like image 192
ming_codes Avatar answered Oct 03 '22 07:10

ming_codes