I wondered if anybody had encountered this problem.
I’m writing an application for Android which allows you to set a scheduled time and duration to record audio – it’s a lot like the application “Informant”. However, I’ve found that if the recording happens while asleep, the phone will almost always reboot after approx 20 minutes or so of recording.
It’s absolutely fine if the phone is kept awake or if it’s charging, but if it goes to sleep, a reboot almost always occurs. Notice that I’m not saying “crash” of the program, I’m saying an actual crash and reboot of the phone itself!
Funnily enough, Informant will also do the same thing, and this is a paid-for app on the market!
Since there don’t seem to be many mentions of this on the net (the exceptions being here: Android phone shutting off while using mediarecorder and cannot get logs and possibly here: http://community.developer.motorola.com/t5/Android-App-Development-for/Droid-Bionic-crash-and-reboot-with-MediaRecorder/td-p/19527 ) it makes me wonder if this is a problem with just certain phones. Mine is the Orange San Francisco (ZTE Blade) with MoDaCo Custom ROM (rooted).
Has anybody seen similar problems, and can shed any light on this? Perhaps we’re just doing something stupid without realising it.
Incidentally, I did try writing the audio files to SD originally, then switched to writing them to internal memory: This second approach seems to make a reboot take longer to occur.
I found the solution to this was to use a WakeLock: Only a partial wakelock is required, and it performs flawlessly. Just lock when you start recording, then unlock when you finish. The phone will appear to be off – there’s no visible difference – but power consumption is increased.
http://developer.android.com/reference/android/os/PowerManager.html
(It’s probably not a problem with all phones)