Firebase database's status state is always not connected, for a Samsung Galaxy A3
, while the internet connection is valid.
On the other hand, same app installed on a Samsung Galaxy S5
works as expected.
I've already reinstalled the app, restarted the phone, restarted the phone and reinstalled the app altogether. I've left out of ideas on how to fix this!
Code that used to detect connection as in the tutorial:
DatabaseReference connectedRef = FirebaseDatabase.getInstance().getReference(".info/connected");
connectedRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
boolean connected = snapshot.getValue(Boolean.class);
if (connected) {
Log.d(TAG, "connected");
} else {
Log.d(TAG, "not connected");
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Log.w(TAG, "Listener was cancelled");
}
});