3

I just started using Firebase for Android and I have hardly and code in the application but I am getting this warning in the console:

 D/FirebaseInstanceId: background sync failed: MISSING_INSTANCEID_SERVICE, retry in 80s

I have done very little reading from the database in the application and have not gotten any data back, so I figure this might be why. I believe I set the application up correctly so how should I go about fixing this warning?

Thank you very much for all help and support!

And in case you were wondering, this is my code:

FirebaseDatabase firebase;
DatabaseReference userRef;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

     firebase = FirebaseDatabase.getInstance();
     userRef = firebase.getReference("Users");

    System.out.println("\n\n\n"+userRef+"\n\n\n");

    userRef.addValueEventListener(new ValueEventListener() {

        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            // This method is called once with the initial value and again
            // whenever data at this location is updated.
            String value = dataSnapshot.getValue(String.class);
            //Log.d(TAG, "Value is: " + value);
        }

        @Override
        public void onCancelled(DatabaseError error) {
            // Failed to read value
           // Log.w(TAG, "Failed to read value.", error.toException());
        }




    });

}

Dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.google.firebase:firebase-database:9.2.1'
    compile 'com.google.firebase:firebase-auth:9.2.1'
}
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Ryan Cocuzzo
  • 3,109
  • 7
  • 35
  • 64
  • This looks like a message from Firebase Cloud Messaging. Did you by any chance include `firebase-messaging` in your build.gradle? – Frank van Puffelen Jul 19 '16 at 00:47
  • I did not, should I? I havent implemented it yet. @FrankvanPuffelen – Ryan Cocuzzo Jul 19 '16 at 00:50
  • @FrankvanPuffelen I am using Firebase Authentication though so would that also make that happen? If so, how do I authenticate? – Ryan Cocuzzo Jul 19 '16 at 01:21
  • As far as I know, FirebaseInstanceId is only used by Firebase Cloud Messaging, through I might be wrong. See https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId . You don't have to implement that service, I'm just trying to understand where the message comes from if you're not including FCM. – Frank van Puffelen Jul 19 '16 at 01:22
  • Maybe [this](http://stackoverflow.com/questions/37427765/firebaseinstanceid-service-does-not-get-registered) could be your problem? – skhugh Jul 19 '16 at 01:32
  • From what I read in that documentation link, it might be. It mentions Authentication in this snipper: "Firebase Instance ID provides a unique identifier for each app instance and a mechanism to authenticate and authorize actions (example: sending FCM messages)." @FrankvanPuffelen – Ryan Cocuzzo Jul 19 '16 at 01:32
  • @skhugh unfortunately, there are no answers on that question and it is inactive – Ryan Cocuzzo Jul 19 '16 at 01:33
  • Can you add the dependencies section of your app's build.gradle to the question? – Frank van Puffelen Jul 19 '16 at 03:00
  • @FrankvanPuffelen I included the dependencies. I apologize for the wait, I fell asleep and I am finally back on my computer – Ryan Cocuzzo Jul 19 '16 at 17:39
  • The dependencies look good. I asked around here and it seems this error is thrown if you run the app on a device/emulator without Google Play Services installed. – Frank van Puffelen Jul 19 '16 at 18:54
  • @FrankvanPuffelen I checked my SDK Manager and I have Google Play Services installed – Ryan Cocuzzo Jul 19 '16 at 18:57
  • @FrankvanPuffelen I am using Genymotion as my emulator though, if that helps. – Ryan Cocuzzo Jul 19 '16 at 18:58

0 Answers0