Martin Vandzura
Martin Vandzura

Reputation: 3127

Audio focus lost - who took it?

Is it possible to figure out who took audiofocus? I have audio app which is losing audio focus without reason(I know it from reports). Is it possible to figure out who took audio focus from my app? There is no api in audiomanager for it but is there some tool? Or is it possible to do ie on rooted phone? Thanks

Upvotes: 2

Views: 1009

Answers (1)

barq
barq

Reputation: 3711

I assume you are getting the log message:

AudioFocus abandonAudioFocus()

You can use the method onAudioFocusChange(int focusChange) to see what is taking your focus.

A possible cause could be an incoming phone call if you have no other downloaded apps that could be causing the problem.

Otherwise there are no public API calls that you can use for finding out which app took the audio focus, but you could find out by reading the LogCat to see what other things are happening around the time when your audio focus is lost.

Upvotes: 2

Related Questions