hatzisn Expert Licensed User Longtime User Jul 22, 2018 #1 Hi everybody, I am trying to implement a solution that would start playing some music when it downloads something and proceed in 5 seconds in the next activity automatically (the music lasts about 20 seconds). Here is what is happening: I am trying to play the music with the with MediaPlayer object. Sometimes the music starts and continues playing when changing to the second activity and sometimes stops immediately when I call the StartActivity method. I tried moving the playing of the music to a service and make the service play it in the Service_Start method. I tried it but the same thing happens again. What is the meaning of all this? Why does Android decide by itself what to do (play continuesly or stop immediately the music)? Is there any way to manipulate this? I tried it in Android 7. Thanks
Hi everybody, I am trying to implement a solution that would start playing some music when it downloads something and proceed in 5 seconds in the next activity automatically (the music lasts about 20 seconds). Here is what is happening: I am trying to play the music with the with MediaPlayer object. Sometimes the music starts and continues playing when changing to the second activity and sometimes stops immediately when I call the StartActivity method. I tried moving the playing of the music to a service and make the service play it in the Service_Start method. I tried it but the same thing happens again. What is the meaning of all this? Why does Android decide by itself what to do (play continuesly or stop immediately the music)? Is there any way to manipulate this? I tried it in Android 7. Thanks
Semen Matusovskiy Well-Known Member Licensed User Jul 23, 2018 #2 To place in service is Ok. The attached sample continious to play, when you switch activities. And more - it plays even in background Attachments zip.zip zip.zip 12.6 KB · Views: 489 Upvote 0
To place in service is Ok. The attached sample continious to play, when you switch activities. And more - it plays even in background