captainblack
captainblack

Reputation: 1033

Android MediaPlayer stops on backpressed

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?

Upvotes: 0

Views: 227

Answers (2)

captainblack
captainblack

Reputation: 1033

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.

Upvotes: 1

Evripidis Drakos
Evripidis Drakos

Reputation: 870

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.

Upvotes: 0

Related Questions