I've developed a music player app where i need to pause music when user gets a call through his skype app. I've tried AudioFocus and phone state listener concepts but it is not working for skype. Can somebody help me out on this.
Thanks in advance.
This link show you how it done with phone call. Sometimes it will help you.
Stopping & Starting music on incoming calls
Related
I'am currently working a mobile application for radio streaming. The problem is when I exit the application the audio stops playing. any idea about this? I really need a help. thank you
You can use service to do that.
Follow the link
Just play the song using foreground service showing music player notification in the notification panel.
You have to create a Service and run it on the foreground. Here is the link to a comprehensive implementation.
I have created a media player application using Android MediaPlayer API. The app is working fine unless a phone call is received. I am handling phone call events in my app and doing pause and play of media player.
The problem is that After pause and play, when phone call arrives, the song is playing but with no sound from speakers.
One more thing is This is happening when I am using bluetooth headset only.
If anybody faced this problem, please reply suggestions to my question.
I solved this problem by stopping bluetooth's SCO before playing a music track if it is ON.
In my application I want to get start time of music player when user started and end time when it stops.I don't want to start any music player in my app. I just want to track user activity in device. So i want my application to get any notification when user started the music .
Do I get any intent for music player started and it stopped.Or do I get any intent for when user opens music files.
Is there any other method other than intent to capture the start time and and time when user starts music player.
Well you can implement the interface 'AudioManager.OnAudioFocusChangeListener' in which there is a method 'onAudioFocusChange' which lets you know if audio focus has been changed, and it can also tell if focus was gained or lost.
See this link, it explains the Audio Focus in detail. An application must gain audio focus through a request, and you can implement the 'AudioManager.OnAudioFocusChangeListener' and if there is focus gain, you can detect if the media player is running, (because some other application such as you tube may gain focus to play its audio), see this to see how to detect which application or service is currently running. You can find if audio has started to play, and if it was the media player or not.
Hope this helps. It was interesting question and I have learned some new things while searching for the answer!
When i open my application , i should not receive any phone call or sms i should stop the media player also. can any one tel me is there any API is available to disable and enable them again once after my application ends.please help me..
Thanks
RAM
It is impossible to block the phone call as referring to this article.
For intercepting coming sms, you may be interested in that thread. Apparently there is a way to do that, but not a clean one.
I have created an application that read messages with voice. I would like to pause any running media player when a message arrives in order to make the voice more clear. Is there any intent that could achieve this aim? I have noticed that google navigator, for example, is able to pause media player (and other music app like pandora).
Thanks in advance
Tobia Loschiavo
This is not an intent, but have you tried AudioManager and requestAudioFocus?
Sadly its only from API 8