I am making an Android application using Firebase realtime database. When a new user registers on my app, that user\'s data is saved in the Firebase database. <
Firebase
Instead of checking for the exists of the reference you can use orderBy query to check whether username exists already
orderByChild('username').equalTo(username) query would return data if some data already exists else it will return null.