title: Music service is started but song is not playing
body: <p>I had created music player service which stop automatically on back pressed. I want to set it continuously until songs are available or user manually close from notification window. Any help appreciated.</p>
  
  <p>Here below i put some code which i had created from reference</p>
  
  <pre><code>private MediaPlayer player;
      private final IBinder musicBind = new MusicBinder();
      public void onCreate(){
          super.onCreate();
          player = new MediaPlayer();
          initMusicPlayer();
      }
  
      public void initMusicPlayer(){
          //set player properties
          player.setWakeMode(getApplicationContext(), 
                  PowerManager.PARTIAL_WAKE_LOCK);
          player.setAudioStreamType(AudioManager.STREAM_MUSIC);
          //set listeners
          player.setOnPreparedListener(this);
          player.setOnCompletionListener(this);
          player.setOnErrorListener(this);
      }
  
      public class MusicBinder extends Binder {
          MusicService getService() { 
              return MusicService.this;
          }
      }
  
      //activity will bind to service
      @Override
      public IBinder onBind(Intent intent) {
          return musicBind;
      }
  
      //release resources when unbind
      @Override
      public boolean onUnbind(Intent intent){
          //player.stop();
          //player.release();
          return false;
      }
  @Override
      public void onDestroy() {
          //stopForeground(true);
      }
  </code></pre>
  
  <p>this code is used in activity to bind service 
  bindService(playIntent, musicConnection, Context.BIND_AUTO_CREATE);
              startService(playIntent);</p>
  
  <p>From above code my service is started but i'm not able to play song directly i had to click on play button </p>
  
  <pre><code>public void playSong() {
          player.reset();
          try {
          sendName_image();
          player.setDataSource(URI object);
          player.prepareAsync();
  
          } catch (Exception e) {
          }
  
      } 
  </code></pre>
  
  <p>Above method is called on button click</p>