sphere4a
sphere4a

Reputation: 125

android app hangs when run for a long time

I have an Android app which listens to a port and updates the screen based on what it hears. This works flawlessly. The problem happens when I leave the app running for say 20-30 mins. During this time the screen would have gone blank for power saving (display). After this point, the app either becomes unresponsive or totally hangs. I doubt if it's memory leaks. Can't figure out how to go about debugging this issue. Any pointers? TIA

Upvotes: 2

Views: 1307

Answers (2)

Martinsos
Martinsos

Reputation: 1693

I was building a widget for android and same thing was happening to me. I believe the problem is that process is destroyed and started again from time to time, and then all your variables lose value. You should use content provider to store them and then obtain them when lost.

Upvotes: 0

Nermeen
Nermeen

Reputation: 15973

May be there are variables that are lost, try to save and restore the state of your Activity using the methods onSaveInstanceState() and onRestoreInstanceState().

check https://stackoverflow.com/a/151940/1434631

Upvotes: 1

Related Questions