hello i am working on new music media player when i play song then not stop or not pause another app's media player like i have two apps 1) "gannna" and another is my app. When i play song in my app's media player then not stopping "ganna"'s media player song.
Asked
Active
Viewed 1,031 times
1 Answers
1
Before your app starts playing audio it should request—and receive—the audio focus. Likewise, it should know how to listen for a loss of audio focus and respond appropriately when that happens.
You can achieve this functionality by 'Managing Audio Focus'. These Links may help you
https://developer.android.com/training/managing-audio/audio-focus.html http://android-developers.blogspot.in/2013/08/respecting-audio-focus.html

Reena
- 1,368
- 1
- 11
- 25
-
Hello @Reena i have two different app with media player so it's works for me? – Bipin Bharti Dec 09 '16 at 05:14
-
Hey please read this link https://developer.android.com/training/managing-audio/audio-focus.html carefully. Audio Manager handles events itself. – Reena Dec 09 '16 at 05:17
-
https://android.googlesource.com/platform/development/+/master/samples/RandomMusicPlayer/src/com/example/android/musicplayer?autodive=0%2F%2F%2F – Reena Dec 09 '16 at 05:26
-
Thank u @Reena it's work for me – Bipin Bharti Dec 09 '16 at 06:00
-
Hey wolud be great if you will accept my answer :) – Reena Dec 09 '16 at 06:23
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/130181/discussion-between-robbypatel-and-reena). – Bipin Bharti Dec 09 '16 at 06:28