I'm developing a radio stream app.I use android - mediaplayer class which plays radiostream. I m trying to run app in two devices . When I pressed back button in Samsung galaxy S3 mini(4.2.2) radio stream continues to playing. And I controls media player with notification bar. But when I pressed back button in Samsung galaxy S3(4.3) mediaplayer stopping to play. Why is stopping media player? How can I prevent stop when pressed back?
I don't use service but still I have not understood why s3 kills activity. But I found a solution . I change my super.onBackPressed() to moveTaskToBack(true);. And I added this option to manifest file in activity tag(Main) android:noHistory="true". Anymore when I pressed back key MediaPlayer isn't stopping stream. Maybe this solution may be useful to someone else. And I thanks for all of you for the answers.
Without some code i doubt anyone will be able to help.
How are you playing the radio stream? Are you using a service? If not the back button on S3 could be killing your app thus terminating the stream.
Related
Hi everyone I recently made an application that is actually a media player of a football club ultras music. I tested it on my phone (Motorola X running Android 4.4.4) when i go back to the dashboard the music keeps playing and everything is OK. But I had a review that on Samsung Trend Plus running Android 4.2.2 the music stops playing when going back to dashboard. I didn't know what may cause this issue? any ideas? Thanx
Most likely your problem is with audio focus. On certain system, when user go to the dashboard, the launcher might take audio focus (and pause your audio play) to play its launch sound (the clicking noise or w/e). Right after that, it should hand back audio focus to you and you will need to resume your playing.
http://developer.android.com/training/managing-audio/audio-focus.html
Need some help who has experience with media player. On Nexus 7 device after pressing home button(pausing media player), when returning to player from recent list, activity is destroying as soon as start of media player method is called. In other devices seems working good. Any suggestions?
Thanks in advance,
I developed a simple music player using MediaPlayer class. I played a song using it, minimize my music player, then I open native gallery, and my application get weird.
It becomes like stuck for a few seconds, and then it started to play new song.
I also did like that using android native player and the player paused when gallery opened.
Do you guys know what might cause my application stucked like that?
I really appreciate any help from you guys,
Regards,
Chrisma Andhika
see in your app, if you minimize your app it goes to onpause() state again come return to app it will call onresume() state. so it takes some time. there is nothing weird in this thing.
In my application I have timer driven video recording functionality. When the camera is in recording mode and if I click on a button on anywhere on the screen the recording should pause. I should be able to continue recording on clicking again.
But there is no pause action for recording video in many of the android devices.
Is there any other ways of doing it? I found this link but it doesn't give me any hope.
can anybody help me?
you can't do that as no inbuilt function is there what you can do it is that whenever you want to pause your app, stop it and start another part, then combine all parts of it...
Edit: If you are using the MediaRecorder, you can use MediaRecorder.Pause() + .Resume() from Android 7.0 (Nougat, API 24) or higher
I am making an music streaming application with music player in it. Now i want that users should be able to switch between activities while listening to music in the player. Also i would like to control and display info about the track being played in one activity.
I have tried implementing the MediaPlayer but is stops playing when i navigate to another activity. Any code example or pseudocode is welcome.
Thanks.
The best option for this is Service.., See this Tutorial.You can learn more Here about services