I've been trying to work out this issue the whole day without luck. Here's what happens: I tested my app and it worked perfectly, then I unplug the phone and leave the app in the background, and after a few minutes, it doesn't start anymore and must be force closed. Strangely enough, the problem doesn't happen when the device is plugged in: I left it there for 2 hours straight and it worked, then I unplugged it and 5 minutes later the app was frozen. I suspect it has something to do with the phone entering deep sleep (I'll try with a wakelock just to be sure). When I plug in the phone and look at logcat, all I see are warnings that the app must be force closed, and this suspicious looking line:
Activity reported stop but no longer stopping
What does it mean? I didn't stop the activity, it's running in the background, and it wasn't killed by the system either because when that happens the app doesn't freeze, it gets killed and must be restarted.
I've never had this problem before and I can't find anything on the internet about this issue: have you ever encountered something like this? What should I do?