2

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

sphere4a
  • 115
  • 11
  • what "listens to a port " does mean exactly? promiscuous mode? – Marcin Orlowski Nov 23 '12 at 16:29
  • Does your app support only landscape orientation? – Ron Nov 23 '12 at 16:30
  • @webnetmobile.com the app listens to a certain network port for incoming data. once data comes in, it is processed – sphere4a Nov 23 '12 at 17:01
  • @userSeven7s: yes... but how could that have a bearing on the issue at hand? wow. very curious to know – sphere4a Nov 23 '12 at 17:02
  • This might help you.. http://stackoverflow.com/questions/13477336/imageview-causes-crash-but-only-when-resuming-from-standby-mode/13496347#13496347 – Ron Nov 23 '12 at 17:03
  • @userSeven7s I think you have pointed me in the right direction. I'm not able to simulate the issue by forcing to standby, but will test in normal mode of failure. Thx. – sphere4a Nov 23 '12 at 17:24
  • userSeven7s pointed me in the correct direction. More help here: [www.stackoverflow.com/questions/13477336/][1] [1]: http://www.stackoverflow.com/questions/13477336/ – sphere4a Nov 23 '12 at 17:30

2 Answers2

1

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

Community
  • 1
  • 1
Nermeen
  • 15,883
  • 5
  • 59
  • 72
  • I don't want to restore state because the app is in running state. Background: the app gives out audio messages to give out certain alerts. The user generally starts the app and keeps it running. If the user just lets the mobile phone sit for several hours with the app running, the app continues to run fine (we keep hearing the alerts correctly). The problem happens when the phone itself comes out of display power saving mode. – sphere4a Nov 23 '12 at 16:59
0

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.

Martinsos
  • 1,663
  • 15
  • 31
  • I doubt it if the process was restarted. This is because of the audio alerts tell me that the app is running and running fine. – sphere4a Nov 23 '12 at 17:04