Hi,

I was wondering if anyone had any ideas or workarounds for solving the
following problem:

1. an AudioTrack (MODE_STATIC) is created from a service,
2. this AudioTrack is played
3. the service is killed (by the OS or the user explicitly) before it
could call stop() / release() on the AudTrack
4. I am left with the sound being played until the phone is rebooted,
since there is NO way I know of to get a hold on the AudioTrack
instance after the service process is killed.

Now there would be no issue at all, if the Service had something like
Activity:onPause() - a method that is guaranteed to get called in the
lifecycle. But it does not. onDestroy() gets called only if the
service is getting stopped, not when its process is being mercilessly
killed.

Is there ANY way to detect in a Process that we are about to be killed
in an ugly manner?
How does the MediaPlaybackService mange to stop playback of a song
when I kill it?

As far as I can tell, none of the AudioTrack's native_stop() /
native_release() / native_finalize() methods get called in this
scenario, leaving the system in an erroneous/inconsistent state.

Thank you kindly for any pointers,

-Szabolcs

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

Reply via email to