警告:“Missing_InstanceID_Service”

时间:2016-07-19 00:39:08

标签: android firebase firebase-realtime-database

我刚刚开始使用Firebase for Android,我在应用程序中几乎没有代码,但我在控制台中收到此警告:

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

我在应用程序中从数据库中读取的内容很少,并且没有得到任何数据,所以我认为这可能就是原因。我相信我正确设置了应用程序,那么我该如何修复此警告呢?

非常感谢您的帮助和支持!

如果你想知道,这是我的代码:

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 {
    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'
}

0 个答案:

没有答案