title: Spotify: save playback state information
body: <p>I am writing an android application based off of the demo activity here: <a href="https://github.com/spotify/android-sdk/blob/master/samples/DemoProject/src/main/java/com/spotify/sdk/demo/DemoActivity.java" rel="nofollow">DemoActivity.java</a> <br/> 
  <br/>
  I want to be able to flip the screen of an android device (portrait to landscape or vice versa) and keep the user logged in and the music playing.  Currently I am able to keep the user logged in, but I am stuck on how to save the playback state. <br/>
  <br/>
  In my onCreate:</p>
  
  <pre><code>if(savedInstanceState != null) {
          String accessToken = savedInstanceState.getString("accesstoken");
          Config player_Config = new Config(this, accessToken, CLIENT_ID);
          setPlayer(player_Config);
          mCurrentPlaybackState = savedInstanceState.getParcelable("playbackstate");
      }
  </code></pre>
  
  <p>
  my onSaveInstanceState:</p>
  
  <pre><code>@Override
  public void onSaveInstanceState(Bundle savedInstanceState) {
      savedInstanceState.putString("accesstoken", accessToken);
      savedInstanceState.putParcelable("playbackstate", mCurrentPlaybackState);
      super.onSaveInstanceState(savedInstanceState);
  }
  </code></pre>
  
  <p>
  my setPlayer (doesn't include authentication because user would already be logged in):</p>
  
  <pre><code>    public void setPlayer(Config player_Config) {
      Spotify.getPlayer(player_Config, this, new SpotifyPlayer.InitializationObserver() {
  
          @Override
          public void onInitialized(SpotifyPlayer spotifyPlayer) {
              myPlayer = spotifyPlayer;
              myPlayer.addConnectionStateCallback(HostPartyActivity.this);
              myPlayer.addNotificationCallback(HostPartyActivity.this);
              updateUIElements();
          }
  
          @Override
          public void onError(Throwable throwable) {
              Log.e("HostPartyActivity", "Could not initialize player: " + throwable.getMessage());
          }
      });
  }
  </code></pre>
  
  <p>
  Sample situation of my problem: </p>
  
  <ul>
  <li>User presses "Log in" button and logs into Spotify account</li>
  <li>User presses "Play" button and a Spotify track begins to play</li>
  <li>User flips device from portrait to landscape</li>
  <li>App automatically logs in the User based saved data</li>
  <li>Spotify track stops playing (should keep playing at saved time)
  </li>
  </ul>
  
  <p>Thank you for any help.</p>