'Firebase onDataChange() not working on some devices

I have developed an app which receiving real time data change from Firebase node.

I am calling below example code for fetching data change if happens in Firebase table for particular node.

private class MyValueEventListener implements ValueEventListener {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {
        Log.i("********** change", dataSnapshot.getKey() + ": " + dataSnapshot.getValue());
    }

    @Override
    public void onCancelled(DatabaseError databaseError) {
        // If we're not expecting an error, report it to your Firebase console
        FirebaseCrash.report(databaseError.toException());
    }
}

Issue: For example 400 devices are there which are in for my app then out of these 400, randomly 20-30 devices are there which are not getting callback in onDataChange method.

I am searching for this from so many days but not able to find the solution.

Any help would be deeply appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source