On Thu, Aug 9, 2012 at 11:23 AM, Digipom <digi...@gmail.com> wrote:
> I got bitten by this the hard way. The official documentation on services
> doesn't have any warnings about this, so I figured onDestroy() was good
> enough. I had some audio shut down code in onDestroy() that wasn't getting
> called when the phone was being shut down, so I'd have a corrupt file
> because the MP4 file would not be properly finished by Android's
> MediaRecorder.
>
> What would you recommend as an ideal way to handle this? Trap the shut down
> intents?

If by that you mean register a BroadcastReceiver from the service for
ACTION_SHUTDOWN, that's certainly worth a shot.

> Unfortunately, it seems that won't handle other instances where the
> app might kill the service, though I do register it as a foreground service.

Not everything is designed to be used indefinitely by a service.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to