Register a User Problem.I'm new to mit app please help

how can i add a condition when the user click the register button and the device id entered is already existing in firebase it will prompt the user the device id entered is already registered

This is impossible to do all in one event, your register button click event.

The most you can hope for in the register button click is to ask Firebase for what it knows about whatever you are trying to register.

Only after the response to that request arrives will you have enough information to decide between complaining or completing the registration.

That requires more event blocks and some record keeping to inform the code that handles the read request's response.

For this, I usually fetch a list of usernames/deviceIds on startup, which can then be checked against the new registration data.