title: Losing connection with Firebase database after updating to new SDK
body: <p>After updating my projects Firebase SDK, I noticed my app regularly lose connection with the firebase database. The time it would take to disconnect ranging from a few minutes to just over an hour. Once disconnected, the app would not reconnect until I have either logged out or cleared the apps data. </p>
  
  <p>Also right before I lose connection, an entry in the log states that my auth token has expired: </p>
  
  <blockquote>
    <p>PersistentConnection: pc_0 - Auth token revoked: expired_token (Auth token is expired.)</p>
  </blockquote>
  
  <p>FYI, im using Twitter and Facebook for my authentication and did not experience such issues with the previous Firebase SDK.</p>
  
  <p>I created a new project (with simple auth and real time database) to see if the issue persists and it does. I've attached snippets of that new project:</p>
  
  <p>The <strong>build.gradle</strong>:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.3"
  
      defaultConfig {
          applicationId "com.sample.gideon.test"
          minSdkVersion 17
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.4.0'
      compile 'com.android.support:support-v4:23.4.0'
      compile 'com.facebook.android:facebook-android-sdk:4.12.0'
      compile 'com.google.firebase:firebase-database:9.0.0'
      compile 'com.google.firebase:firebase-auth:9.0.0'
      compile 'com.android.support:design:23.4.0'
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <p>The authentication activity follows the firebase facebook login guide, which indeed successfully logs the user in and sends them to the MainActivity which then monitors the database connection using the following code: </p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>    DatabaseReference connectedRef = FirebaseDatabase.getInstance().getReference(".info/connected");
      connectedRef.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot snapshot) {
              boolean connected = snapshot.getValue(Boolean.class);
              if (connected) {
                  System.out.println("connected");
              } else {
                  System.out.println("not connected");
              }
          }
  
          @Override
          public void onCancelled(DatabaseError error) {
              System.err.println("Listener was cancelled");
          }
      });
  </code></pre>
  
  <p>Would anyone know what is causing the app to lose connection? So far the error has been experienced in 2 different projects with 2 auth providers (twitter and facebook) and only after updating to the new Firebase.</p>