Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The way the media player works is that its runs as a service and then is stopped MANUALLY when the user stops it in the application itself. </p> <p>Example:</p> <p>When the media player is playing a song and the user hits home, obviously the user still wants to listen to the song as its a background task. After the user is done listening then the user manually stops it by going into the application and stopping (Aka stopping the service that is playing the song) it or if the playlist is done, then stop. Simple.</p> <p>This is the expected behavior. And it is exactly how the Music App works.</p> <p><strong>UPDATE</strong></p> <pre><code>@Override protected void onPause() { super.onPause(); if (this.isFinishing()){ player.stop(); } } </code></pre> <p>Needs to be changed to</p> <pre><code>@Override protected void onPause() { super.onPause(); if (mediaPlayer != null){ mediaPlayser.stop(); if (isFinishing()){ mediaPlayer.stop(); mediaPlayer.release(); } } } </code></pre> <p>An explanation:</p> <p>The reason we are checking for the object not being null is obvious. However; when we enter the pause, we want to ensure that the mediaplayer is stopping. <strong>BUT</strong> if we are leaving and the song is almost done, then stop it and release it.</p> <p><strong>UPDATE 2</strong></p> <p>Check the link here:</p> <p><a href="https://stackoverflow.com/a/6704844/529691">https://stackoverflow.com/a/6704844/529691</a></p> <p>This can be used to detect if your application has been moved out of the current tip of the application stack.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload