My team and I are working on an alarm clock function on an Android device that, if necessary, tries to bring a device out of sleep mode, and sets off an alarm scene using a native Java plugin. But we’re facing a problem – it crashes about one in six times, due (we think) to a problem with the application taking too long to load on startup. The device tells us that the app is not responding after starting up. This means our code to start up the app is working. But it does this instead of starting the alarm, meaning that our alarm clock doesn’t work.
In DDMS we get an error citing ANR (application not responding) as the issue, and then a WIN DEATH (window death) comes after, which means that our activity was killed by the system, correct? We have since learned that this results from an application trying to do too much in its main thread. However, we don’t know:
-
How to avoid this problem in Unity, by causing the main thread to do less work. The first scene the alarm clock opens is empty. The entire app is about 80.6 mb.
-
Why this problem would occur when the alarm happens while the device is sleeping, but not at other times.
I’ve attached logs of what the device does when it’s successful and when it fails. Help me, Obi Wans! You’re my only hope! Our deadline is tomorrow.
Here’s the FAIL log:
Here’s the SUCCESS log: