title: Lose connection with firebase
body: <p>I have a big problem with Firebase. the app logs off from Firebase, without saying anything, in fact by starting the app marks me that the user is logged properly. But this is not reality, because for example when I go to add an item in the Firebase database, it is saved locally but not on the server. This is a problem because the data does not are saved and I need a re-authenticate to re-establish the connection. And when I do unsaved data are eliminated.
  that gives me the error is as follows. I've already seen a question on stack but I have been of help. the file that requires the mistake I successfully downloaded. I can not understand why this thing happens to me, the first did not.
  I thank you for the help</p>
  
  <pre><code>W/PersistentConnection: pc_0 - Provided authentication credentials are invalid. This usually indicates your FirebaseApp instance was not initialized correctly. Make sure your google-services.json file has the correct firebase_url and api_key. You can re-download google-services.json from https://console.firebase.google.com/.
  </code></pre>
  
  <p>EDIT
  the problem is when i restart device. when i turn on the device the notification receiver load automatically an alarm for notification, i think that it is that do the problem of firebase. how do I resolve this?</p>
  
  <p>notification receiver</p>
  
  <pre><code>public class NotificationReceiver extends BroadcastReceiver {
  SharedPreferences sharedPrefs;
  
  Calendar calendar;
  public void onReceive(Context context, Intent intent) {
  
       sharedPrefs = context.getSharedPreferences("SETTING_NOTIFICATION", MODE_PRIVATE);
  
      if (sharedPrefs.getBoolean("on", true))
          Notification(context);
  
  
  }
  
  private void Notification(Context context){
      calendar = Calendar.getInstance();
      calendar.set(Calendar.HOUR_OF_DAY, 20);
      calendar.set(Calendar.MINUTE, 15);
      calendar.set(Calendar.SECOND, 0);
      Intent intent1 = new Intent(context, AlarmReceiver.class);
      PendingIntent pendingIntent1 = PendingIntent.getBroadcast(context, 0,intent1, PendingIntent.FLAG_UPDATE_CURRENT);
      AlarmManager am = (AlarmManager) context.getSystemService(context.ALARM_SERVICE);
      am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pendingIntent1);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>in manifest</p>
  
  <pre><code> &lt;receiver android:name=".AlarmReceiver" /&gt;
      &lt;receiver android:name=".NotificationReceiver"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>