Firebase auth in Sketchware for Login Activity

To create a login activity using Firebase Auth in Sketchware, follow the steps given below. This method uses Firebase authentication service for creating login.

1. In your Firebase account, go to Firebase authentication.
2. In Firebase authentication web set-up, go to SIGN-IN method, and enable Email/password and Anonymous.

3. Go to Project settings in your Firebase project and copy the Web API Key, Project ID, and App ID.
4. Paste the Project ID, App ID, and Web API Key in your project in Sketchware, in the Firebase settings.

5. On the MainActivity page add a File Shared preferences component user:user and an Intent i. Also add a Timer t and a Firebase Auth testlogin.

6. Create a new page login.xml with Activity called LoginActivity.

7. In onCreate event of MainActivity use blocks as shown in image below.

It identifies main page with File user key page. It also checks if user is logged in to FirebaseAuth.
If user is logged in then other blocks are executed.
If user is not logged in, he is taken to LoginActivity using Intent i.

8. On LoginActivity VIEW area,
* add two Linear(H) loading_linear and linear3.

* In linear3 add two Buttons button2 and button3 for Sign in and Sign up respectively.

* Below linear3 add two Linear(V) login_linear and register_linear.

* In login_linear add edittext3 and edittext4 for email and password respectively, and add a Button login_button for Sign in.

* In register_linear add edittext7, edittext6 and edittext5 for nickname, email and password respectively. Also add register_button for Sign up.

See the image below.

9. In LOGIC area of LoginActivity, add a new File Shared preferences component user:user (same as in MainActivity),
a FirebaseDB component user_id:userid, and a Firebase Auth component testlogin (same as in MainActivity).

10. Add a List Map map1 and a String list uid.

11. Also add a Map variable map_var, and a number variable n.

12. In onCreate event of LoginActivity add blocks as shown in image below.
These blocks identify page by setting value login to file key page. They also make loading_linear VISIBLE and other linears GONE.

13. On button2 click add blocks shown in image below. These blocks make login_linear visible, and button2 red.

14. On button3 click add blocks shown in image below. These blocks make register_linear visible, and button3 red.

15. On register_button Click, add blocks as shown in image below.

These blocks check if the EditText fields are empty. If they are empty it toasts a message. If not empty, it registers the email and password of user to Firebase Auth and makes loading_linear visible.

16. Add event Firebase Auth: onCreateUserComplete and use blocks as shown in image below.
If the user is registered successfully, these blocks push his FirebaseAuth Uid, and his nickname to Firebase DB user_id. If registration fails, these blocks make register_linear VISIBLE.

17. Add a new event FirebaseDB on child added. In this event use blocks as in image below.

These blocks get data from Firebase DB to List Map map1, and then create a String list uid from all the uid in List Map map1, and make login_linear VISIBLE.

18. On  login_button click use blocks as shown in image below.

These blocks Sign in user using Firebase Auth and make loading_linear visible.

19. Add event Firebase Auth: onSignInUserComplete and use blocks as shown in image below.

If user is signed in using Firebase Auth, these blocks save his nickname, and move him to MainActivity by Finishing LoginActivity.

20. Add onBackPressed event and use following codes in it.
21. Again in MainActivity, add onStart event, and use following blocks.

22. In VIEW area of MainActivity add a button (button2) for Sign out, and on the event of button2 click, use following blocks.

23. Save and run the project.

Here the nickname entered by user and his Uid created by Firebase Auth, are saved in Firebase realtime database.


  1. This comment has been removed by the author.

  2. Please make a video on this topic

  3. When i type a massage my name is not showing

    1. I believe you mean "message." A massage is a difficult thing to type...

  4. Hi can you make a tutorial about linear elevation

  5. Replies
    1. Firebase in Sketchware:

    2. Thanks m8, and i'll leave here the link from that playlist for the sign in Tutorial (At least i think this is the one!):

  6. This comment has been removed by the author.

  7. This comment has been removed by the author.

  8. How to listen data on firebase map and showing the data as text on sketchware?

  9. Sir,i need your help..i m gone trough ur tutorial , login activity by firebase auth ,attatching link "",but sir after completing the app its registered well and then automatically login thereafter.but when i clicked signout,and then go though login button itself ,its nothing do.what will be problem,ithink onsignincomplete event not working.or ??

  10. Password verification block create

  11. Hii
    How make firebase auth with login counter
    means how to know how many times user login to app in sketchware

  12. Hello, I had made a chat app already... but I'd like to enable users send messages directly to a particular user.. possible?

    1. visit and download We Chat

  13. program is stop loading screen !!


  14. do it seriously narration and practice 0

  15. Sir how can the admin veiw shared peference data of users?

  16. What is supposed to go in the add source block? Its cut off in the picture

  17. Please, I am getting "internal error occured ,invalid api key" when trying to login or signup. Please how can I fix the error

  18. Svp comment faire le mode de connexion par numéro de téléphone dans sketchware

  19. Hello, i need your help

    When i try to sign up or login i get an error. "" unreachable host or timeout "" .. please help

  20. Is there any way to make firebase phone authentication and OTP features in sketchware.
    Is possible then tell us .

  21. what is inside the asd block? In the 7th step. please help me

  22. how to make admin login and user login with one firebase ?

  23. The app crush when I click login because edittext for email or password is black. Help me?

  24. Could we make accounting apk by sketchware

  25. Sir,how can i add notification for android oreo + version in new sketchware app
    It give error every time

  26. Add source directly is not filled as there is no code given. Please fix it

  27. Sir Please make a video on this topic

  28. This comment has been removed by the author.

  29. On the first set of blocks I'm getting errors saying listview1 cannot be resolved and in the picture the last part of the same green line is missing.

    Also, another error I'm getting is

    _auth_sign_in_listener cannot be resolved to a variable

  30. Even if the firebase is already added, and I add the ad later, the app is not being created.

  31. i was lost with no hope for my wife was cheating and had always got away with it because i did not know how or

    always too scared to pin anything on her. with the help a friend who recommended me to who help hack her phone,

    email, chat, sms and expose her for a cheater she is. I just want to say a big thank you to

    HACKINTECHNOLOGY@CYBERSERVICES.COM . am sure someone out there is looking for how to solve his relationship problems, you can also contact him for all sorts of hacking job..he is fast and reliable. you could also text +1 213-295-1376(whatsapp) contact and thank me later

  32. How do I sign in my email to unlock my admob

  33. In onCreate event of MainActivity if user is logged in add source directly, please paste the complete code thanks...

  34. Your blogs are authentic and great. Are you also searching for cheap nursing writing company? we are the best solution for you. We are best known for delivering quality essay writing services to students without having to break the bank


Post a Comment

Popular posts from this blog

Simple car racing android game in Sketchware

Creating a Drawing View in Sketchware

Enable Fullscreen for Youtube videos in WebView

How to enable upload from webview in Sketchware?

List of Calendar Format symbols valid in Sketchware