Android + Firebase Email/Password Authentication | Stevdza - San | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Android + Firebase Email/Password Authentication

teacher avatar Stevdza - San, Android Developer & UX/UI Designer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

21 Lessons (2h 3m)
    • 1. Introduction

    • 2. Create Firebase Project

    • 3. About the Course Project

    • 4. Sign in Screen

    • 5. Sign Up Screen

    • 6. Home Screen

    • 7. Update Email Screen

    • 8. Update Password Screen

    • 9. Connect Firebase to Your App

    • 10. Validate Input Fields

    • 11. Sign Up New User

    • 12. Loading Animation

    • 13. Sign in an Existing User

    • 14. Show Account Info on HomeActivity

    • 15. Log Out a User

    • 16. Loading Animation v2

    • 17. Update Email Address

    • 18. Send Verification Email

    • 19. Check if Account is Verified

    • 20. Update Password

    • 21. Troubleshoot

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

This is a 'Complete Course' for developing Android App using Firebase Authentication Platform. You will learn how to implement Email and Password Authentication for your Android App. The course is well organized. We are going to start by introducing you to Application Design structure where you'll see how our app will look like and how will each and every activity communicate with each other. After that we are going to implement our App design in Android Studio and start with development.

Next you'll learn how to connect your app to Firebase from Android Studio Firebase Assistant, how to validate your inputs before sending data to Firebase platform, how your users can easily sign up to your app, how to sign in to your app, how to verify their email address with one click, how to update their email address, how to update account password and more.

I'm going to show you potential bugs/errors on you can run into while developing your app with Firebase Platform, and how to fix them easily. We are going to follow development practice, and how to keep our code clean, separated and organized.

Meet Your Teacher

Teacher Profile Image

Stevdza - San

Android Developer & UX/UI Designer


Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Introduction: Ah, hello there. And welcome to my course in this course. And we did shoot how to connect fire base authentication to your android application. So this is our demo application In the final version, eso if we type of password, less than eight characters were going to get error message. And if our email address is not well for mated, we're going to get our message as well. So let's form a our email address properly, all right? And when you click signing you will get the Never again. And that's because we don't have an account yet, so let's create one. Okay, choose your email address. This is just an example to show you password will be from 1 to 9 and repeat pestle again. Click sign up and there you go. So, uh, let's trick if we have our new account in the five days console, so click this Ah, refresh button on the right side to refresh. And there you go. Now we can see our a new account created here. Okay, so let's get back to our application. And here we also care about three more options to log out update email and password as Well , so we're going to log out and log in again. So I chose password front tonight. Signing and weaken. Sign out using the back button as well. So click. Yes. And there we go. It works perfectly. So let's logging back again and you can see down below. It says that our account is not verified so we can verify it. Our account by sending verification email address. So in this video introduction, we do. I want you. I won't show you that. But I will show you how to update your email address. So just click this and they're ago. Our email address is updated, so we're going to track that as well. And inside our fibers console. So click, refresh. And there we go. Our new address email address. Appear right away. Okay. So we can also obviate the password here as well. So let's ah type from 1 to 9 and we're going to add 10 the end click of a password, go back and log out so we can log in back again with our new email address, Of course. And your password. So if you type your password, you will get an error message like that. And if you enter your new password, you will be redirected to your home activity. So what are you waiting for? Enrolling these scores now and start to learning and improving your skills right away. 2. Create Firebase Project: fire is fire base is ah, online Google Platform and, ah, it is used as beckoned. A service fibres gives you lots off functionality, which you can implement in your application. Firebase Support the IOS Android Web Unity and the C Plus. Plus, you don't need to buy any expensive host or ah, database server. You can use a firebase for free, so five days gives you lots off functionalities like hosting database machine learning for more by developers. Cloud functionalities, Authentication for your users, cloud storage, two story or files images and many more. You also care of, ah, Google analytics connected to your fire base. You can implement in APP messaging, cloud messaging, remote configuration, dynamic clings and many, many more. Recently, five days announced the firebase extensions, which are new functionalities in five days to use. You can also integrate Google ads. Add mob play store Ah, big query slack and then many more into your application. So, uh, this course we're going to focus on ah, authentication. So, uh, you can use a fire base authentication toe to store your users in tow database fire into five days database, and you can easy, easily even and that function into your applications so your users could sign up and the signing to your application and excess a specifically spit specific data and get the specific access to your application by signing. It's a very easy to implement this. So, uh, click get started or ah, visit console toe Goto firebase console. So here you will see. First, you will need to register, of course, But once you are logged in, you can see here. Ah, added project. So basically, there are two ways to create the firebase project. The 1st 1 is using the Web browser, and the 2nd 1 is through Android Studio Five Days assistance. But now I'm going to show you how to do that in the Web browser. So click add product here and we're prompted toe Add our name for the project. So once you enter the name for your project, fibers will automatically generate unique I d. For that specific product. So let's type, for example, my firebase project okay and down below is conceived. You'll get the unique I d for your project. Okay, click continue and your prompted toe prompted toe enable Google Analytics four or five days product which is a very, very useful for your application. You can check through Google analytics. You can check how many users are currently active in your application. In the common users are viewing, viewing your activities and so on. So once you're fibrous, project is ready. Actually, continue and it will redirect you toe five based console here for your product and on the left side. As you can see, we have all the function that is ah, from Fire Base, which we can implement in our application. We have our dedication and database storage hosting functions, machine learning, kid, Crash analytics and many more. We have also extensions down the low. But for the scores, of course, we're going to focus on on fire base authentication, So select the authentication here and here in user stead. When it's some off your users register in your application. This is where you will see their email address and all those informations. So next here we hear a bunch off options toe choose from. We can authenticate the using Google Facebook Twitter phone number and so on. But for now, we're going to stick with email and password. So now, like this enable option and save it. Okay. And there you go. You can successfully saved that options option, and you are ready to start with implementing authentication to application. Here. You also care templates for, ah, email address verification for password reset. For example. If your user wants to reset email address, he will get the this automatically generated email in the inbox. Okay, so that was it for, Ah, this video. In the next video, we're going to start by designing layout for our application. And after that, we're going to start by implementing a fire base authentication. 3. About the Course Project: uh, shoulder. And they're welcome back in this video, I'm going to show you the mobile design, which I created using Adobe's D. So basically, we will have ah, fuel screens signing screen where user will signing a sign up screen where it was a real sign up. If doesn't have an account already, we have a home screen where we will present the information from that user. We have also options to log out, change email and change password, and we never screens for those two options, says where. So if a user clicks signing and he will be a writer redirected to a home screen, and if user clicks not a member of sign up text below, he will be redirected toe a sign up screen, of course, from a sign up spring was, could get back to signing spring using a back arrow and would sign her button. Of course, again will be redirected toe a form screen from my home screen. If user clicks log out, it will be redirected toe a first screen. If user clicks changing mail, it will be redirected. Toe are changing male and the same goes for change. Possible. Of course, from changing male and change passwords. User can get back toe home screen using a Baquero as well. So that's pretty much what So our firebase project will work. And then the next video, we're going to start by implementing this design in tow, Android studio in the forest. After that, we're going to implement all the necessary functionality for fire base authentication. 4. Sign in Screen: uh, hello there. And welcome back in this video, we're going to start by designing our layout in Android studio. So first, we're going to design signing screen. Um, and signing screen will be, ah, in the main activity. So that will be the activity which first starts when you run the application. So it's concede this is our design. So we're going to have a to edit text, one button and one text view. So let's said that those at the text one for email and the 2nd 1 for a password. All right, Next we're going toe connect the left right constraint and the top constraint. So it's connect the password a text constraints toe. Ah! Ah, email. Ah, text. And now it said the button. So again, connect left, right. And the top constrain toe secondary text like this. And ah, this ah text view will be connected to a button. I'm both okay. And let's set the 16. Ah, did be from the button. Okay. And now it's Ah, open up a text you hear and see and let's cut and paste this text view on the bottom. So we're going toe change the ideas for all off our elements here in our layout. So, for example, for the first day text I will choose a sign in e mail I d on the father for the secondary text. I'm going to choose a sign in password I d. So let's change those constraint ideas as well. Okay. And ah, after that, let's ah, change a button idea toe assigning button. Okay. And after that, we can change the text. We can add a text. New idea. Eso i d should be something like create account text. Okay? And it said Let's change button text. So signing and we're going to add one more attribute, text or caps toe False. Okay. And now I think we should the add a petting to our route constraint layout elements. So I went with the right and left betting 2 53 p. And I want to set all my elements specifically to wear the text and a button toe match. The constraint with so somehow those elements Ah, are not expending. Um, so it's, uh decrease the petting toe. 20 dp. Okay. And still nothing. So I think what is Ah, what is the reason? Because we need to set the left and right constraint or zero. And now Now we have, ah, fully expanded the text. Any text here? So let's switch back from the 20 to 50 dp on the petting. Okay. And we should expand our button as well to match those air text in. Ah, with so but said the match parent. Okay. And now it was better. So, uh, we're going to style eyes this lay out a little bit more. So let's have the background for our button. I will choose black color as the background for our button because we don't share a black color. We need to create a new one inside our colors. XML file. Okay, so I'm going to wear new item here. The name will be black, and the hex code for this color is 000 the next time going to create one more caller, which is white. And the hex code for that is ah f f f. Okay. Now we can set the text color to our button toe white, so we can actually see the text here. Okay? And I think we should increase the height a little bit. I think now 60 is Ah is appropriate. Okay. And maybe we can increase a little bit off button text size. So let's add it as well. So text size toe 20 sp Let's check it out. I think it looks good now and let's ah, modify this text to your little bit. So we're going to change the text toe something like not a member sign up. And when the user clicks this, it should never get him toe new activity to assign a new account. Okay, it's around the application to see how it looks like in our android emulator. So, um and I took it out, okay, which would add it this style a little bit more. So I don't like this pink color when we focus on ah edit text and I will remove extra bar as well. So let's ah change their color A sense toe black from a pig to black and we're going toe open a styles dot xml and we're going toe toe items window extra bar will settle false and the window No title we're going to set True. So basically we're going to remove extra bar and the activity title okay. And there is only one more thing that we should change. You can see now when we focus on our any text, we see a black hole, which is very nice. We want the simple style with the only white and black. So I'm going to change the color primary and the cooler primary dark toe, be black car. And now I think it should look perfect. So let's, um, let's first at the hint to our 20 texts for the 1st 1 will set email address in the 4th 2nd We're going to set up password. So let's open up. And there you go. Now we should have Ah, good looking and simple layout for our application. So in the next video, we're going toe design Sign up screen in ah, Android Studio. 5. Sign Up Screen: show there and welcome back. So in the previous video, we should designed the signing screen in our enjoy studio project. And now we're going toe design Sign up string. So first, I'm going to export this Baquero from our Adobe's day so we can import that into our project. If you don't have, ah, other base that you can just down on this simple back arrow from Internet, it's ah, very easy. So now I'm going toe create a new activity, its name, this sign up activity. Okay, and now it's It's open on that layout. And instead of just adding those buttons and elements, I'm just going to copy There was 20 texts and one button from our signing activity, which is main activity. And I'm going to pace here. Okay? The next thing I went to where the left and right betting which I gather the in our main activity I out as well. So the next thing we're going to rename all those all those ideas for our elements because we don't want them to match because we're going to get there are otherwise. So let's change that. Let's change all those constraints ideas as well So for a button with stranger, a sign our button. Okay. And, uh, it's Ah, copy this. Edit text one more time. Because in our sign of activity, we're going to have three other texts. So strange, this idea to repeat password. Okay. And now, um, now, let's check out that, uh, how it looks. Okay, but, uh, remember, toe add or modify those ideas by ourself, Otherwise you will get an error. So here we need to change shame for our text and text for our button. So she it will be repeated password. And for the button next, we should add just the sign up. Okay, that's good. So the next thing we need to read is ah, back arrow. So let's import svg from from Earlier where we exported that from Adobe X Day. So let's find that Baquero on the desktop. Let's select. That's like, Okay, again, If you don't care, Adobe's that you cannot down or this Baquero from the Internet. It's another big deal. Okay, And now this is a file. This is the XML coat off our Baquero, and we're going to add one guideline here so it will help us design our layout more easily . So let's to drag this layout on the left side to match the address off our elements. And we went with the image of you and inside the team as we were going toe Add our Baquero . Okay. Just like okay. And connect left and right. Constraint left constrained toe a guideline and top constrain toe apparent a top constraints should be around 16. Okay. And now it looks better. So the next thing we're going toe add on click listener into our main activity. So basically, we're goingto initialize text to you for our create account, and we're going toe set on click listener in our own create matter here. Okay, So basically, we're going to use intent toe to navigate to our sign up activity when user clicks text you . Okay, Just past the perimeter of the 1st 1 is made activated on this, and the 2nd 1 is a sign of maturity. Got class salt activity, and that's it. And now we need to add one more on click listener for our back arrow so we can never get back to our science activity. So first, Ok, you know, imagery. We have a never because we haven't told the enjoyed studio that we're using vector files. So basically, we need to add just one line of code. Don't worry. So we're going to open a greater build moderate application file. And where were the one line? Of course it's that simple. So just below this fine, of course, we're going to write lower case letter vectored robles dot You support library equals to true. And after that click sign sink now and the aero showed that this disappear. I think if everything is OK, okay, Now there is no more ever so we can change the idea for our image. You toe Baquero and we're going to use that I did to initialize our image viewing sign up activity. So where exactly was the on click listener for our back herro? But instead of using intent, we're going to It was simple method called finish and it will basically end this activity and it will automatically switch to our parent activity, which is ah, signing activity or main activity. OK, and now let's run our application to check how that works. Okay, So when we click signing or a spot already text view, we'll get the new activity and sign up activity. And when we click this Baquero, we're going to get back to our previous security. So it's that simple. So that would be all for this video in the next video. Working to Design Home screen. 6. Home Screen: Hello there and welcome back. So in the previous to reduce, we should designed the signing and sign up string. So now we're going to design home screen in our android studio. So first of all, go ahead. Go ahead and create one new activity for our home screen. So we're going to create empty activity. Name off. Our activity will be just simple as home activity, please. Fears. Okay. And after that, we're going toe at the petting on our route constraint layout element here. So betting left and right toe 50 dp. Okay. And now from our signing or main activity, uh, we're going to copy a button and Ah, here. We're going toe rename I d toe log out button. So this will be along with button this stranger text as well. And we can remove those three constraints from the last from the previous screen. So now we're going to move this log out button down there a little bit, and we're going to create two more buttons. So let's copy this button. Okay. First women toe where the left and right constraints and let's set our constraints to zero to measure the parent OK, and Now, let's copy this. Go down below. Two more times. One for ah, change email button and the one for Ah, change password button. So let's change the ideas. Change email button. All right. And the next one change a password button. Okay, That should work. Eso change the text here as well. Change password and above change email. Simple as that. Okay, so those three buttons are pretty much the same, so I think we should change that. The last two buttons will be kind of different. So in orderto do that, we're going to create a new ah resource file toe style eyes our button. So it's first, uh, go ahead in a draw. Global directory. We're going to create a new resource file, right click, new wardrobe or results file. And it's named this a secondary button. Okay. And is our wrote element. We're going to choose the shape. Shape will be a rectangle. And inside our shape, we're going to add a stroke item stroke with will be ODP, and the stroke color will be black. And that's it. We have ah, designed our secondary button. So let's import that style inside our our two buttons So in the background, attributes were going toe link our secondary button XML file and we're going toe. We're going to do the same for the for the third button change password. And, of course, text color for our buttons should be a black because we need to see them. Okay. And that looks pretty much fine for now. So next the way to where the text appears, one which will represent an email address. So every time a user logging toe his account, he will see its ah email address in the unique I D. Which is generated for each and every account you create. Okay, so it said one more text view and let's connect those text views with the constraints. So first left and right constraint, of course. Set to zero. Okay. And talking straight constraints connected toward text you with Ah, margin off 16 and log out button corrected toe a text you with Margin off, for example. 50. Okay, now that was better. So it's a stylized our to text view is a little bit, but before that, let's cut those text news and let's pays them on the top. Okay? Place them here and We're going to change some attributes here for those text views. First will be the I. D. So, uh, first text, you will have Ivy, for example. Email, address, text over case letters. Of course. All right, now we're going to change the idea off those constraints idea. And the second text, you will have idea off. I d text Simple. Is that okay? And now we can stylized those text years a little bit. So let's change the text toe email address. Of course, we're going toe later. Videos. We're goingto dynamically change this text, but for now, it should stay. An email address fixed size 24 and down below. Text size 20 s p core black, of course. Okay. And now let's check it up. It looks fine. So let's decrease this number from 16 to 8. Okay? And, uh, now it looks fine. So it's at the on click listener inside our signing activity or main activity. So we're to initialize our button here first, which is a signing button. Okay, let's find the ivy off that button. I d. Is. I think the same signing button. Okay. And here, we're going to set on click listening inside our own create method. And we're going toe pacing the intent and change the parameter Toho moated. So whenever we click assigning button, it will it will redirect us toe Aho, maturity like that, Of course, in the later videos were going toe change that and at the firebase functionality. But for now, you should just add debt to see how it should work. 7. Update Email Screen: hello there and welcome back. So in this video, we're going to design update email screen. But before that, I want to make a few changes. So instead, off change email and change password, I want to say update email and the a bit password. So we're going to make those changes inside our I change email and change password activities or now update email and password. So next we're going to do that the same in our home activity layout. So here we want to change the button I D and button text from changer, email, toe update email and hear from change password to update password. So just change those ideas in text. It's pretty much it will stay. Put him out of the same except those text. Okay. And now we have successfully updated our screen so we can focus on a new screen, which is ah, of the female screen. So now we need toe at the one button here inside our home activity. So we're going to initialize up the email button and we're going to set on click listener. So whenever we click our over our update button, our updating your button, we're goingto get to redirected toe our new activity, which is up the email activity. So now we're going to create this new activity. So, uh, new activity and choose a M ticket. Okay? Name will be update email activity. And now we should, um, start with designing our Abit email screen. Okay, so, uh, we have a two Any text, one button and the one image view for Baquero. So we're goingto copy those elements from a sign up layout. So let's copy those two were the text one button guideline in the image. You. So copy that and paste that inside our new activity update emailer xml file. So we need to have betting. Ah, left and right. Of course. And, uh, here we're going toe. Just change those ideas to match our new activity. So instead, off this idea, we're going to type a new email and down below the secondary text. Sorry, the 1st 1 will be a current email, and the 2nd 1 will be new email. So let's change that. Okay, we're going to remove those constraints because we're going to add them manually. Okay, so we have got, like, guideline and the image of you as well. So what changed him for our to a text? 1st 1 current email and the import type. Of course, to match the text email address a 2nd 1 the same. Okay. And this one will be a new email. Okay. Button as well. Uh, will be update email and the i d of the female. Okay. And the Baquero will be changed. Toe back a row number two. Because we are We already have a back a row, I d. So let's move those elements down below. Okay? Baquero should stay as it is, and we need to match those constraints now. Top constraint to marry 16 and the left constraint will be constrained toe a guideline and right constraint toe apparent. Okay, so so zero to match the parent top constraint or 16. So this one I left and right, of course to zero. And the object email connected to a new e mail edit text and left and right to zero as well . Okay, that top in strange should be 24. Ok, And the now we're going to connect our first any text, which is a current any text, current email toe a parent and the top constraints should be, I think a little bit more than two hundreds. Maybe to wreak underrate its circle that toe 380. Okay. And, uh, we can run our application to see how that looks. Okay, so let's run the application, click update email. And they're this. So I think we should lower down top constraint from from a 380 toe, maybe 350. OK, and now let's surround the application to see how that works. Okay, click signing object email, and there you go. And, of course, when I click back button, it should lead you back toe to your home activity, which is apparent activity toe our new activity. So in update email activity class, we're going to initialize image view, and we're going to find the idea of that element inside on create method. Okay. And we're going to add the on click listeners so we can never get back. Okay, But we are not going to using that. We're going to use a method called finish, and it will automatically redirect toe parent activity, which is a home of spirit. Okay, now, let's run the application and see if that works. So when I click back there is it works like charm. So that was it for this video. The next video. We're going to a design change. Password or sorry, a big password activity. 8. Update Password Screen: Hello there and welcome back. So in this video, we're going to design Ah, the last screen, which is update Best world screen. So a big password screen should look something similar or the same as our of the team mailer screen. So let's create new activity here. Let's name that update password activity and the Instead of writing the code layout called by ourselves, we can just copy the code from a previous layout, which is update email. And ah, we can copy all those elements in just based inside our new ah layout. So let's do that. We're goingto copy toe where the text, one button guideline and image you. So before that, we need to wear the petting left and betting right toe our road play out elements here set to 50 like we did on all previous screens. And here we need to change those ideas so we don't want toe have same ideas because that might crash your application. So now here we were to say, Ah, new password for our first area test. Okay, let's change the hint toe new password as well. So import type should be Ah, text password. Okay, thanks. Best word and the damn below, which would change. I d toe repeat password. So because we already have repeat password I d. This'd idea should be repeat password number two. So, uh, Okay. Now it's fine. And it's changed the schemes toe. Repeat password. Okay. Input type, text, best word as well. And here we can change those constraint ideas as well. Okay. Sorry. Not the new email, but new password. Okay, so this text will be connected toe text above, and this button will be acquainted Toe that it text above. So ah, here, type a new password. Oh, sorry. Repeat password. And, um, here on the button type text of the password and, of course, changed the idea Toe update Password as well. Okay, um, I think that's it. We should just change our back Aero image view, I d. So instead, off Baquero number two. This one should be Baquero number three, because this is the third baquero in our application. Okay, now that we shovel, our layout created pretty much the same as last one. Um, we're going toe whether to, um, click listeners. So the 1st 1 will be in our home activity for our update password button, and it will redirect us toe our new activity. And the one more quick listener for our back era. Of course. So goes yet and open up home activity. It's at new button here. And let's ah, find the idea off our update password button inside our own create method. Okay, find the idea. Find you by the of the faster, I think. Okay. And let's set the on click listener, Of course. And let's copy this intent, okay? And let's change this toe update Password activity. OK, so now let's ah, run our application to see if that works. Eso Our application got crashed, so I think I know. Why is that? Because we missed typed Abit password button idea. So instead, off update password bt and I typed just update password. So you gotta be careful when you are. Ah, initializing your buttons here. So now it's a running application and see if that works. Okay? Now it works. And when you click covet password, it will open up a new activity. So the last thing we need to do is create on click listener for our Baquero number three for our other password activity So here initialized image view. Let's call that the back arrow and let's find the idea off that day care, which is back in our number three All right, and set like listening, of course. Okay. And just he was method finish. So now let's stick it out. So I bit password go back and it works like a charm, so that's pretty much it for our screens design, which have designed all our screens. And then the next videos we're going to start by implementing a firebase to our application . 9. Connect Firebase to Your App: Ah, hello there and welcome back. So in the previous videos, we have designed all our screens in the android studio. And now it's time to connect our five days producto our android application. Okay, so in order to do that, you need to select ah in a top bargain to select tools and you need to click your fire base down below. So when you do that, it will show you in five based assistance on the right side. So as you can see that there there are a bunch off options. But we need toe click or dedication here. So now click email and password authentication and it will Ah, and you will see here. Ah, fuel steps toe. Connect your application for five days. So basically you can use five is the authentication to let your user assigning Ah, with their email addresses and passwords. So to connect a click this button connected five days, you will be prompted with this window. So if you are first time using this five Asian itto log into your account. But once you are rewarding hearing your android studio, you will be prompted toe select your fire base product as you can see so we can see the name off our project. Uh, my five, This product and that product was created in the first video discourse when we created the product from from a Web browser. Okay, so just re Correcto fibers. And after that, you will need to wait a little bit on Thea Andrews Studio connects your application for five days. After that, you're going to see this check mark in the text, which is which says connected. So that's a good thing. Next, we need toe klik this at five days notification to your application button. So there was this. You need to first enable email impassable authentication from your five days console. But we already did in our first video discourse. So So that's a good thing. Now just click this button and basically, you need to add the firebase. Dependence is here. You will be prompted with all dependencies, which will be added to your project. Okay, So as you can see, all those dependencies will be added. You just click accept changes, and that's pretty much it. You just wait until android studio fingers this process and there you go. You have successfully connected your android application to your fire base. 10. Validate Input Fields: Ah, hello there and welcome back. So in the previous videos, we have a connected our enjoyed project toe warfare, fire base platform. And in this video, we're going toe implement functionality toe validate our input. And those imports are email and password in this case. So why we need toe validate those inputs. Well, because before we sign up for signing toe are fire base, we need to verify that, for example, our password contains more than eight characters and for example, our email contains Ah, that sign and so on. So you'll see first in our main activity went toe Ah, and those edit text for email and password. And next, we are going to create the new general class. So, uh, like New Java class and we can select the package private your consent toe public if you want, But I always there was a private when I can. So the name of our class will be valid input. So just like okay. And now first women to create the constructor, of course. So the constructor should have the same name is our class, and that's basically the first method to be executed with when we initializing call our class. So now let's first create the to or three, um, three orbits. So we need toe. Say we need to have a context and the text for email and password. And now we're going to wear the three parameters inside our constructor. So we need to add context. We need to add the edit text for email input and edit text for a password input. Okay. And now it's Ah, set those. Ah, those. Let's connect those objects here. Okay, email with my email and password, my password. And now it's set those to private. You don't share too. But I always do that when I can. So I'm going to create a new method boy and method called the very late email. And inside this method, we're going to verify that our email import is is filled with the appropriate text. So this method will return true if everything is OK and it will return false If it's not, of course. So I'm going to create a new string and inside the string, I will put I will get a text from emailing put convert to string and the putting our new stringer variable. So if you're wondering what is this stream method? Tree method basically removes all all blank spaces from beginning and the end of the text. So inside of book, we're going to check if our email input is empty and if that's true, weapon to display a simple toast message saying Please enter your email address and regulatory returned. False, of course. And inside the else. If block we're going to check, we're going to the pattern class and we're going to it was this email address pretty find the better. So basically it will attract if that people text is correct and it contains all the characters which are considered is Ah, I don't know, email text. So basically, if that's not true, then we're going toe display toast message saying invalid email address any. We're going to return false and then else block women to return. True, of course. And let's remove this from bottom, okay? And now we're going to create a new bully and method called the validate password. So a zit can see this basically yet the text from our email input in store getting inside this email input string, and we're checking if that text is empty or if it contains characters. For example, at character Toby recognized as email. So next is the bully and method named Validate Password. So again, we're going to create the new string in store this input the password text. So password get text to string and dream, and now we're going to use it book. So we're going to say if our password input is empty, we're going to display a toast message saying, Please enter your password and we're going to return force. Of course. Okay. And women there was one more massive blocks here and we're going to say if our password does not contain more than or conceive password input length is less than eight. Then we're going to display Toastmasters saying a passport or short and we're going to return false, of course. And in as block, we're going to return. True. So that's pretty much it for our a very did input class for now. And we're going to use this class and implement that inside our activity so you can see how that works. Okay, so those methods will return true value. If everything is ok and the otherwise, it will display a toast message. So inside our main activity, we're going to initialize our validate, impose class and inside on create method. We're going toe just say new, very dating put. And there's the parameters were going toe past three parameters. The 1st 1 is main activity. The 2nd 1 is ah, signing email at the text. And the 3rd 1 is Sangin password Edit text. Okay, And now, um, inside the on click listener for our signing button, we're goingto, uh, two Boolean variables. So the 1st 1 will be called the email. Very fight and we're going to was our method from validate import class, which is called the Validate email and Women toe store, the result of that method inside our bullion. And we're going to do that the same for our password. So those values will those methods will return true if everything is OK. So in this if block, we're going to say if email verified in the past, well verified are true and only then we're going toe. It was intent and the navigate toe our home a ticket. So let's check it out. So when you click signing, as you can see, we got the toast message saying Please at your password. Please enter your pastor. Okay, so let's at password lower than eight characters, for example. Only three. And you can see toast message saying a passport or short. So let's said the more than eight characters or eight characters. And now we get the Toastmasters saying, Please enter your email address. And now it said the some random characters like that click signing and you get toast message saying invalid email address and only when we type correct email address, for example, like this and when you click saying only, then it will never get us toe Toho man committed. So now that we have, ah, another type of show you how toe Validate those inputs. In the next video, we are going to start by implementing sign up functionality toe our fire base platform 11. Sign Up New User: Ah, hello there and welcome back. So in the previous video, I showed you how to implement Validate input class for a validating your email and password inputs. So why is that important? Well, it's important for a security matter. Before you were even Ah, trying to create or signing to your account on fire base, you need toe very fight. Ah, you're ah, your input fields, like email and password. So that's pretty important for your application. So in this video, we're going to start by implementing a sign up function for a fire base platform. So first in, sign up activity, we're going to add the three architects and one button, So ah, email, password and repeat password. The edit text. Okay. And one button for a sign up. Okay. And the after that, we're going toe. Find the idea off those ah elements as well. So remember, toe, always remember Ah, your correct ah element I d. Otherwise, you might get an error and your application can crash. So that's very important. Okay. And I want to rename those variables those objects. So for sign up, we're going to find the I d. And I think the idea is Ah, sign up, button. So I went to rename the initial button name from Sign up to sign a button, All right. And the next we're going to create own quick listener for our sign up button. Okay. And, uh, next, uh, we're going to go to our validates input class and that we're going to create one more constructor so we can match the the three at the text. So I'm going toe add one more at a text for repeat password and one more constructive with the same name, but with different number off parameters. So instead of three parameters, we're going to hear before parameters, the new one is for a repeat password. Okay. And inside that new constructor, we're going to connect those. Ah, and there was, ah, context in the text like we did in the first constructor. Okay. And after we do that, we're going to create a new method here. Eso just below the validate password method. We're going to create a new bullion with the name off. Repeat password. The validation. Okay. And for now, ah, I'm just going toe create. Ah, um, three global strings in instead off local strings so we can access those strings in each and every method. So, uh, string for email, input, password input and, of course, repeat password input. So, as you can see, those strings are now global. Okay? And a new one for the third method. Okay. And, ah, in our newly created method, I'm going toe. Ah, say, ah, group it password, huh? Not get taxed a string, Of course. And I'm going to store this text from our repeat past or the area text in tow. This string and I'm going to return. True if ah, password is equal store Repeat, password text. Okay, that's just for now. We're going to modify this method the later a little bit, but for now, it should stay like that. Okay. And next inside that remain activity on the sign. Ah, quickly, Snow. We're going to copy this code, and we're going toe based that inside our sign up activity and the inside our own click Listen for our sign a button. But we're going to change this context to sign up activity. Okay? And we're going to initialize our new class very dirty input and in on create method. We're going toe past the parameter four parameters. So the 1st 1 is the context, which is our current activity, which is sign up activity. Next one is Ah, email. Ah, edit text for email. The next one, a text for password and the last one a text for repeat password. Okay. And now that we care that we can, ah, access our newly created method So we're going to create the new bully. And here, inside, on click Listener, we're going to rename that repeat password verified, and we're going to store on this ah bullion into our new variable. So in this if block, we're going to add one more condition. So if those three are true and only then we're going toe redirect to our home activity. So let's try it out. So we're going toe enter email. Ah, and the pastor And of course, a repeat passer. Okay, this is just an example email. And if you click sign up, nothing happens. And we're going to change that. So instead, off not getting success message. We're going toe modify this this method toe toe, show up a toast message. So here, we're going to create if block and we're going to say if a repeat password input is empty, we're going to display a toast message saying, for example, fill out all fields and we're going to return a false okay, fill out all fields and in else, if block, we're goingto say if if a repeat password is Ah, uh uh. He's not equals toe. Ah, password. The text. So repeat password input. So that's a repeat password edit text. So if that text is not the same as in a pastoral, any text, then we're going to display a message, a toast message, and we're going to return. False. So that's those message can be passwords don't match, okay? And in else block, we can just the return True. Okay. And now we can run our application and, ah, check how it works. Okay, so here type email address and just in summary, an example. For now, Pestle will be from 1 to 9, let's say and ah, repeat password. We're going to repeat the pastor because we're getting a toast message. Fill out all fields as we already created that. And now let's at a different password. So it says best words don't match so we need to match those two passers in order to access home activity. And there you go. So it works perfectly fine. And now that we have all that created and verified, we can now finally implement firebase sign up functionality. And we're going to do that here. Inside, sign up activity. So open up of fire base assistance on the right side. And copy this. Ah, far based authentication class. We're going to initialize this class inside the own create method. So copy this code as well. Okay, We can close this fibers assistance for now. And here we can paste this cold for five years, okay? And we can scroll down a little bit, and we're going to see sign up new users, and we can copy all this code. And of course, we're going to modify this Ah, 12 or ah, Application goal. So, uh, instead off basing this court inside on quickly snow. We want to create the new method so we don't want to have a messy code. Instead, we're going to share a new public void method called the Sign up A new account, for example. Okay. And here we're going toe paste. Aled that code. And of course, you're going to get those red Ah, text. So you need to import all those classes. Just hold the old and enter toe import all those classes, and we're going to remove. Ah, some of those lines, of course, because we don't need them for now. So we're going to remove death as well. Okay. And this as well. And this as well. All right, so basically, here we're using Ah, create. Ah, with email and password. The method from our fire base authentication. And you were going to pass here. Ah, email and password strings. And of course, we have on completely snow. So ah, in on complete. When the task is successful, we can set our intent. So only if our account is created, created successfully we can never get to our home market. And now we're going to slowly implement all that functionality. So let's remove this as well. And this court from a sign a button on click listener, we went toe cut that code, and we're going toe based all of that inside our sign up new account method. Okay, so just the control X to copy and control V to paste. All right, So, um, next, uh, we can, ah, cut and paste that cold inside our if block. And this intent will be inside. Ah, on successful. Ah, task here. So only if our account is successfully created. Only then we will never get from sign. Opportunity to home activity. Okay. And the else block weaken. Just this place. Simple thoughts, metric messages saying fatal error. This is just an example. You can customize that message if you want. And this sign up method will be executed inside our own click listener. Okay, Now it's a way better. So, uh, the next thing we want to do is ah, check. And if if you see we're checking, If those three billions are true and only then we're going to lose this create user with email and password the method. Okay, so we need to create two strings for email and password. Okay, so let's create those here on the top and inside those strings were going toe store the text from our email and password edit text. Okay, so here on, we're going toe store, Uh, the text from our edit text. So email equals toe our sign up email. He's okay. The name is sign up email. So get text to string, Quiver to string and trim. All right. And we're going to store the password, the text in the password, the string as well. And the after we have stored all those informations inside our email and password the text . Only then we can pass those variables inside our create user with email and password method . Okay. And the now we can open application and check it out How it works. It's not that hard to implement this. Ah, functionality toe. Ah, to sign up for a new account. As you can see, we did in, Ah, a few lines of code. So as you can see, we're passing those values here, and ah, we have gone completely snow here. And if the task is successfully, we're going to run the home activity and ah, in else block were just displaying a simple toast message. So for now, it will be stay. It will stay like that, but we're going toe Add the loading animation in the next video. But for now, let's check it out. So here we're signed up for a new account as you can see in our fire base. Ah, platform console console. We're not seeing any account. So here, I'm going to type my email address, for example, with the password from 1 to 9. And I'm going to do the same for the next password. Okay, I can write the same password or okay. And when I click, sign up. Nothing happens. But as you can see, we are navigated toe our home activity. So that means that our account was successfully created. And as you can see in our firebase console, we can see our newly created account. So, uh, the reason why we don't see any message eyes? Because we haven't implement in that function. But in the next video, I'm going to show you how toe Ah, add the beautiful loading animation when you click. Sign up for a new account 12. Loading Animation: Hello there and welcome back. So in the previous video, we have implemented a sign up functionality for our fire base. And now in this video, we're going to create the some kind off animation with the progress Ah, bar. So it will serve as, ah, an indicator when we click sign a button that something is going on in the background. So we're going to create the new layout resource file for that matter, and we're going to name that just the loading. So here I, we're going to use ah, constraint play out as a parent. Ah, layout. So here is a height were goingto say a rap content and that is very important to set because if you don't set, then your alert dialogue in which we're going to implement this layout will show on the whole screen. So next here, in our layout, we're going to have the Progress bar, and just below that, we're going to add a simple text feel. So let's going those constraints for our elements left and right to zero and top toe apparent with zero as well. And they said it text connected toe This progress bar with a 16 margin and left and right. Constraints toe zero. Of course. All right. And this text, we will say just a simple for example. Please wait. So, uh, this layout lower than XML file would be set on our alert dialogue. So you will see. Now, let's just add this text here, okay? And that's fine. So go ahead and open up a sign up activity, because now we're going to implement a with the functions winning toe. This play this layout. So first way we're we're going to create other dialogue builder, and we're going to initialize that allowed that builder inside our own create method, and we're goingto pass our context as a parameter. So, uh, build our equals two Newell Urdl Wilder, and just pass. Ah, sign up activity or just this. Okay. And down below on the bottom, we would wear the new method. Public void were to name that matter, the loading animation and the inside this method, we're goingto add all the functionality. So first we're going to have the layout inflator so we can inflate our newly created layout . Okay. And down below, we're going to use a set of you method for our alert. Dial a builder to set of the view to our newly created layout. So choose this layout from layout directory, okay? And is a second perimeter. You just type now? All right. And next week when it was set, cancel able method and willing to set that to fall. So, user, I cannot cancel this cellar dialogue, okay? And we're between was now alert Diallo class. And we're going to set the builder to create and the dialogue method show so we can show our alerting dialogue, All right. And this loading animation will be used in our own click listener. But for now, I'm going to set this loading animation in on great method so we can see how it looks when we open our sign up activity. So let's run application and let's open up. Sign up activity. And there it is. So this is the animation how our animation we look like when we pressed sign up button. So now just cut this coat and the paste inside our sign up new account method, which is called in a sign, a button click. Listen, residency. Okay, so now let's open up application. And, uh, well, it's Ah, create the new accounts here. So this is just an example. Email example and dreaming about calming the past work for 1 to 9. So just repeat that one more time and click sign up. So as you can see, our animation is working, and after the task is finished, we are navigated toe our home material. So that way we know that our account has been successfully created. 13. Sign in an Existing User: Ah, hello there and welcome back. So in this video, we're going to implement the sign in function for ah firebase console. So as you can see, we have already implemented a sign up functionality for ah, our fire base. So let's open up application and check it out how it works. So ah, we're going to create the new account because I have deleted the previous accounts. So it's a truce password from 1 to 9 and the click sign up. So when the task is successful, we will be navigated toe a home screen. And as you can see, the account is created. But ah, if I click a bag button, I will get back to a sign up activity with this Ah, alert dialogue that cannot be cancelled. So we need to fix this bag and we're going to do that by going toe a sign up activity and inside this Ah, if task successful block, we're going to add the method finish. So basically, when we, um when the task is successful, we're goingto navigate to a home screen and we're going to end the life and the life off our sign up activity. So let's check it out. How that will work. We're going to create a new account example to weigh at gmail dot com with the same password. So click sign up. Okay? And ah, now, as you can see, the account easy created. And when you click back, we're navigated not to sign up activity but main activity instead. And we don't see this. I love dialogo anymore as well. So that's fixed. For now we can dilate our accounts from a firebase console does by pressing this delete button. It's that easy. So ah, goes yet ah and navigate toe main activity Because now we're going to implement sign in ah , functionality for five days. So we're going to create the fire base authentication on object, and we're going to initialize that inside our own create method. Okay, so here are just the type of fire base authentication get instance as we did in our sign up activity. Okay, so open up this fireplace assistance and the scroll down a little bit, where you will see Ah, this code for assigning an existing user. So we're going to copy this whole code as we did in the previous activity, and we're going toe create the new metadata called the signing new user off or a signing new account. Okay. And the we're goingto paste this code inside this method. So it's pretty much the same is in our sign up activity, and then we're going toe dilate all those Ah ah, useless lines of code. And we're going to import all those classes we need to do and the answer that, uh, we're going to create new to new strings for email and password. So we went toe ah, store or all our text from edit text for password and email inside those those two strings . And we're going to use those strings in our signing with email and password method like that. Okay, that's pretty straightforward. And now, from this one click listener, um, we're going toe cut. Ah, those lines of court like we did in our sign of activity. So it's pretty much the same stuff, and we're going to copy the slowing any mention because we're going to need that inside our signing activity as well. Or main activity. Sorry. Okay, So it's based this Ah, down below. And the we're going to create a lower dialogue builder object. And we're through initialized that inside our own create method. Okay. And the pests, of course. Ah. Main activity, class or context, which is this? And the After that, we need to cut this code from our own click listener air. We're going toe pace that inside our new method signing account. And this intent should be located inside this. If block, if task is successful, then we can never get to home activity. And here in else book, we just need the weather. Simple toast message saying a fatal error otherwise, Okay. And now this Ah, all code will be pasted inside this if block above, so just, uh okay, control X and control Veto pays that. And of course, those two strings as well. Eso as you can see this if block we're tracking. Ah, If those two billions email verified and password verified out our true and only then we're executing our coat. So let's ah, call this method inside our own click listener, all right? And this loading animation inside our signing account method here, And I think now we can start ah, application to check it out. How it works. Okay, so enter Ah, an existing email address. But before that, you can create the new account here as well. So I have deleted my previous account. So I need to create a new one example and dream may look calm. A password. One from 1 to 9. The same is before All right. And here the same. Okay, just click sign up. And now this account is created. So now let's run our application again so we can see how our sign in function works. So let's said, uh, our new account here and the password and click signing. Okay. And now we share successfully signing to our home activity. And when we pressed back, as you can see, we have, ah, this bank again. But on our signing activity or main activity, and we're going to fix that by by adding this alert dialogue object. Ah, on the top of that so we can have a global objecting set off local. All right, so we can globally access this alert dialogue here inside on complete listener. And here give. The task is successful. And when we start activity, we're going to dismiss our loading animation, so let's check it out again. enter the password, of course, and click saying so when I click back button Ah, that alert dialogue will disappear and we have successfully fixed that bug. So when we click when we enter a different password and click signing, we will get fatal error. But our dialogue will not dismiss. So here in else block, we need to add the dialogue dismissed as well. And now our application will work. Fine. Okay, so just type email address in the some random password click signing. We will get fatal error message and our Diallo will disappear so that that's a good thing. And that is the reason toe add that this Ah, a little trick inside our sign up activity as well. So we will create a seller dialogue as a global Ah, All right. So we can access the subject inside our one click listener on complete on completely sinner story and this else block, we're going to add dismiss so we could fix this bug in our sign of activity as well. And the our application should work like a charm. Okay. And that will work fine. So we can easily signing to our account and in the next video. I'm going to show you how toe access your account data and show your account email address and the unique i d here inside. Okay, so that was it for this video, and they're seeing the next one. 14. Show Account Info on HomeActivity: shoulder and the welcome back. So we have already implemented a sign up in signing functions. So, as you can see when we fly to logging toe our account, as you can see, our account already exists. So, uh, when we log you, we want toe this play our account email and unique idea toe our home string. Okay, so when you don't type your password and click signing, we will get this boring dialogue. Oliver dialogue back again. So finally, now we're going toe I get over with this bag for once on and for all. Okay. And now in this block, women toe had else block, and we're going to add dialogue. This Miss method, we're going to copy this little trick and add in our sign up activity as well. So in, Sign up a new account method down bill at s block, and, uh, the same trick. Okay, so this ah alert dialogue bag will not bother us anymore so we can try that out. So, for example, type this email address and for password, you don't type anything just like signing and you get the message. But this bag is ah no longer active. So that's good for us. Next. What we're going to do, I want to show you how toe show your account information on your home home activity. So it's going to be pretty easy. The only thing we need toe do is create a fire base authentication and the fire bases user classes here. But before that, let's ah, initialized text view. Ah, objects for ah, email address in the I d. And let's find the idea of those toe excuse hearing on create method. Okay. Just remember, toe choose the right i d for those elements. Otherwise you might get an error. Okay, Find the idea. Find you buy a day. I d i d text. Okay. In here, I'm going to create the fibers, fortification class and the object. Sorry. And I went toe initialized. Those two in ah one create method. So five days notification get instance and ah ah, five is authentication. And get current user. So I'm going to add if blocks, so if the condition ah user is not know. So basically, we're, uh we're telling the program or our application to check if the user is actually logged in tow an account. So if a user is actually loved in. We're going toe this play those informations. So I have created two strings for email in the I D. And I'm going to store this ah, email into our string and for the ideas. Well, I'm using get email and get I D u I d methods so down below I'm going toe. Just use a set text method for our text views, and I'm going toe pass this string here and down below I d text set text to my idea, and that's pretty much it. So let's run our application toe check how that will look. Okay, so let's type our account example and jimmy dot com and password from 1 to 9 click signing . And there is we can see our email address and our unique I D. So if you want you can we can compare those informations in the firebase console. So let's do that. And as you can see, this unique idea is, ah, pretty much the same. Okay, so that's good thing. And I think we should modify our lay out a little bit so we can decrease our text i d size text size from a 20 sp toe, maybe 16 sp. So it's Ah, let's change that. And let's check it out How it will look now I think it will look away better. So it's logging toe our account fear example a dream, a lot comb and password from one denying as well. So click signing. And there you go. So now this unique I D is a little bit, um, decreased so we can see that more clearly now, and that's pretty much it. 15. Log Out a User: Hello there and welcome back. So in the previous video, we learn how we can display account information inside our home activity like email address and unique I. D. And this video we are going to implement the law, got function. So there is something you should know before we start doing that. So whenever you log into your firebase account five days stores talking, talking on your local storage. And basically that means whenever you destroy your application and run again, you will be always logging into your account, no matter what. And the only way to log out from your fibers account is toe Sign out explicitly using sign out method, which were you will see later in this video. So, uh, now inside the main activity, I'm going to show you hell toe how toe check If user is logged in. So basically, we're going toe. All right. That one method, the on start, which is ah, method which starts before on create method. And in that method, we're going to check if user is logged in and if a user is logged in to his account, then we're going toe immediately. Transfer a user to our home activity, so you will see how that will work. So as you can see now we can see our email address here, and that means we are logged in to our count. That means we are looking to our account, but we need to transfer user from main activity toe home activity and let's got this block of code and we're going toe. All right, The method on start. So just below on create method press control and diaper on start press center. And here we are overriding on start method. And here we're going to paste our coat from before. So here, every time we open up our application, we're checking. If our user is logging toe his account and the if that's true, then we're going to display this message with the user's email address, and we're going to navigate our user from an activity toe home activity with the intense. So you will see. Now, how will that work? Um, so whenever we open up our application, we will be immediately transferred well or redirected toe home activity and in as block, I'll just type something like please logging to continue, okay. And the now I think we should start their application to trick it out. Okay, So as you can see, we immediately got redirected to a home activity because we are already loading toe our account. Unless we explicitly sign out. So, uh, in a home acuity, we're going to wear the on click listener for our log out button, and we're going to implement function to look out. So now create one more button object for log out. And we're going to find the idea off that button in our own great method. Okay. And after that, of course, we're going to create on Click Listener down below. Okay. And the inside on click listener, we're going to add the sign out method. And after that, we're going to add the finish method. So basically, when we signed out, we want toe redirect our user toe signing screen, which is the main activity, and ah, now you'll see how that works. And, yes, we could display a simple thoughts message like, please log in to continue. Okay, so let's run application to check, uh, how it works. All right, So we are immediately transferred to our home activity, But when you click log out. We get this message, please. Looking to continue. And when we ran our application again, we are not redirected to our home screen because we have logged out successfully. Okay, so this part off the cold works perfectly for us. And ah, there is the one more thing we need to implement in our application. So you will see now. So whenever a user clicks back button instead, off log out a za could see we get the immediately redirected from main activity toe home activity. And the reason behind that is because in our main activity, we have implemented own start method. Basically, when we try to go back to main activity on start method is checking. If there's there is longing. And of course, your user already is logged in and it sent us back to our home activity. So there is, of course, fixed. So that and now I'm going to show you how toe things that bug. So now we're going to create Ah, maybe new Ah, or we're going toe. All right, the on back press metal. So basically, whenever we press the big button, we're going to execute some block of coach here And that broke, of course, is our dialogue building. So we're going toe build the alert dialogue, which will say, for example, Are you sure you want to look out? And if the user clicks, Yes. Then we're going to is a method Finish toe. Destroy that activity and toe Get back to ah, toe main activity. Okay, so I can set the title for this. A lot of that will be left to log out and message toe. Are you sure you want to walk out now? We need to add the lower dialogue object and we're going to is a builder create method and the they look show. But before we show our dialogue, we need to have two buttons, one positive button and the other negative button. So for the positive button, uh, a text should be Yes, and I'm going to use on click listener. Okay, so I'm quickly snow and here. If there's a click CS, then we're going to sign out and will be to his method. Finish toe, destroy this home acuity so we can get back to our man activity. You'll see. Okay. And we can display a toast message the same is from above, like please, looking to continue. And the women? 12. The negative button, Of course. With a text off. No. And when the user clicks No, we're going to just dismiss this alert. Violent like that. Okay, As you can see it interested? You automatically added the final word in front of follow dialogue. All right, so now we can try this This new function we have. So let's start our application. As you can see, we're directly automatically redirected to a home screen. And when it really clog out, we're locked out. So even if we're on application again, we won't be redirected to home activity unless we Logan again. So we're going toe organ again? Of course. And the click signing. Okay. And when I click back button, this alert out of will appear. So if we click No, this will disappear like that. And if we collect yes is conceived. This activity is over and we are redirected to our scientific. So that's it. Basically, that's all the functionality we need for our local its function. And it works perfectly. 16. Loading Animation v2: Ah, hello there and welcome back. So in previous video, we have designed a sign out function in our application. So ah, in our firebase console the wheel ready have created this ah example at dreaming about com account. And now let's try out our sign that sign out function once more. So type your email address and password from 1 to 9. So signing and we're going to log out by pressing a back button Click, Yes. And ah, As you can see, it works perfectly fine. So in this video, I want toe modify our lower dialogue loading animation a little bit. So basically, as you can see here in Maine activity, we have this loading animation method and we have this same method inside our sign up activity. So basically, it's a good practice toe not repeat this code in a more than one activity. So instead, we're going to create the new class, and we're going toe benefit from that by decreasing the line of coats in ah, the lines of courts in our application. So let's name this class loading animation and let's set tow package private. All right, So, uh, here, um I'm going to copy this school from loading animation method, and we're going to use this code in our class. Okay, So first, we're going to create a constructor, Of course. So, uh okay. And we're going to create one method named the loading animation Dialogue. So here, I'm going to paste this code from our method from from before and they were going toe create activity object. And we're going to pass that activity a za parameter in our constructor. All right, so here I want toe use activity, object toe, get this layout inflater. And I'm going to create the lower dialogue builder object here inside this method. So just initialize this new Ardell of builder and we're going to pass activity as a parameter. All right, so the next thing what we're going to do, we're going to create the alert dialogue object as well. But this time, this cellar Della will be a global object so we can access this object in one more method. And let's create that another method. We will call this something like this missile loading animation. Okay. And here, we're going to use Ah, just this dismiss method from a lot of dialogue Okay, So, uh, let's just said this those toe activity in the Lord I'll of two private okay? And now we could proceed and, ah, modify our main activity a little bit. So you will see how many space or lines of codes we will save by creating this class separately. So will delay this, and we're going toe created. So loading animation object for our class And let's remove this court from before. We will just leave this comment from above and we're going toe rename this comment. So a loading animation and here we're going to initialize our new ah object for our class, and we're going to pass our main activity as a parameter. All right, next what we're going to do, we're going to remove some of those coats like this loading animation. We don't need any more this method. So does the late that and the above. Here, we're going to remove this school a swell, and we're going to set toe call our method from our holding animation class, which is loading an animation dialogue. And here we're going toe Really This and we're going to our second method name dismissed loading animation. So it's copy this code and pays two more times. So in else block and wants more time. All right, so that's basically it. So we could have saved our, ah, our codes line, of course, in our application, and we can check if our application is functioning in the right way, so we don't have any box or something. So let's logging in. Ah, type your email address and password, of course. Okay, I'm just checking out there that's working. So from 1 to 9, and when you click signing, as you can see this alert dialogue loading animation is working perfectly fine. So now we can proceed and implement this same trick inside our sign up activity. So let's remove this method. Let's remove those two objects create for new one for our class. Remove this line of code as well. So let's initialize or class and passed Sign Opportunity is a parameter okay and down below . Let's use our new class, and it's ah method. Now let's remove this as well. We went to his our second method and let's copy and paste this line of CO two more times, all right. And there it is. We have successfully modified our Oliver dialogue loading animation and saved a bunch off line of schooled in our in our applications, so that's pretty much it. 17. Update Email Address: Hello there and welcome back. So in this video, we're going to implement update email function in our application. So, as you can see in our other female activity, we have a to wear the text one for current email, the second for new email. And, of course, button the trigger. An action. So here what we want to do I want to set the current email edit text. I want to actually get the my get my email address from Fire Base and the automatically set my current email attacks to match that email address. So here, in our update email activity, we're going toe, create a text, objects for our current email and new email as well. And of course, we're going to add a button as well. So let's find the idea of those three elements inside our own create method. Okay. All right. Let's said all those elements here and we're going to set the in clique listener for our of the eight email button. Of course. Okay, so double check those ideas, so they need toe match correctly. So at the click Listener for our update email button and we're going to add the fire base authentication object as well as forbids user object. So let's initialize those two classes sheer in our own create metal. Okay. And for our user five days. What indication? Get current. He was okay. So, um, all the action will be triggered in aside our own click method buying on Click a listener. But we're going to create a new method named the set current email. So basically, we're going to get our email address from a fire base platform, and we're going to store that female addressing a string, and then we're going toe automatically set the text for our first current email edit text to our email address. Is that simple? So basically here I'm checking if user is actually logging. So that's very important, because you don't want an authorized user toe Ablett your email only logged in user Kendall that so here I'm calling set current email method. All right, so we can check dysfunction now. Now restart application. Click update email. As you can see, our current email is example at gmail dot com. So we have a set our email address here, and we have disabled our first edit text so users cannot interact with that. Only our application came so in as block, I'm just going to set one simple toast message just in case. So it should say something like police looking toe Continue. Okay. And, um, I'm not. I'm now going to use a very did input constructor. So basically, I'm creating a new validate people constructor here, and I'm going to pass on Lee Two parameters, one context and second for email address. Okay, so I'm going to use this new constructor in our update email activity class. So here I'm going toe create a very detained put object, and I'm going toe initialize this class inside our own create metal, and I'm going to pass the two parameters. The 1st 1 is my update email activity. And the second perimeter is, of course, a new email edit text. Okay. All right. So now inside our update email on click listener, we are creating a bully, a bully and variable, and we're going to store our very good email method a result. So if our email is very fight and if user is actually loved in here in our application and only then we're going to update the email address. So here I am going to greet the new string in which we are going to store. Ah, our our text from a new email edit text. Okay, And in update email method, I'm going to pass this string. So it's that simple. As you can see, it's basically one line of court toe a bit. Your email. So now I think we can also add a toast message toe. Say something like email address updated successfully. Okay. And in else block we could we could type just ah, simple toast message with, for example, invalid email address. Okay, you could customise those messages if you want, but for now it will stay this way and we can run our application toe check how that works so you can see our current email addresses example at dreaming of dot com. So let's go to our update email activity and let's type new email address. So I'm thinking, I'm typing my own email address, and when I click update email, I get this updated successfully toast message, and when I refresh our five base platform, I get to see my new email. So, as you can see when I get back to home activity. I don't see that this application is updated. You y my current new email address. So we need to change that. And the only when I log out and log in again, I will see this. This updated you? Why? With my new email address. So let's check it out. Click Logan. Okay. You can see now it updated my you I But we want to do that when I get back from from my email update email activity to home activity. So we're going to fix that. And before that, I want to show this structure. So basically, when our home activity is running and when we start the new activity, for example, update email activity on pose method is executed. And when the user returns toe home, activity on resume method is executed. So this means that we need to all right, on resume method inside our home activity. So just, uh, called the control. Oh, so it will prompt you of indo. And here just type on the resume and said like this on your resume method, click, enter. And here we're going to copy this court from my own create method. So basically here. We're grabbing our email address from Fire Base platform, and we're going to set the text to our our email edit text text for you. Sorry. So now when we all right, this on resume? It'd That bag, which I mentioned earlier should be fixed now. So it's Ah, check that out. So let's ah, look out first and logging again. So this is our new email address with the same password from 1 to 9. Okay. And his conceit e let's update our email address. So this time I will type something like my new email at the dream mail dot com. And when I click bait email, I get the success message. And when I get back, as you can see, our you are is now updated. And that's a good thing, of course. And okay, our email is a bit here as well. So there is one more bug. So Toby fixed. So when update our email when we type here, for example, a new email address. When you click update email and get success message, our first at a test here does not change. So we need toe fix that as well. So the way we're going to fix that is going to be easy. Don't worry. So inside our set current email method, we're going toe set our current email toe set enable to true. Okay. And hearing inside our own click listener inside the If Book, we're going toe Adam Chandler. So basically, we're going to set the delay for our set current email, Uh, method. So basically, when we update our email, we need to wait a few seconds until a fire base is ah, updating our email address, and only when a firebase updates our email address, then we can request to see a new one. So basically, we're waiting one second to read a new email from a fire base, okay, and only then update every text. So here it's ah, around our application. Protracted death works. So basically the time you know you need to wait toe read Your new email address is a based on your Internet speed connection. So in this case, I just set with timeto one second. And as you can see, I'm not getting my first teletext abated. So let's increase from one second delay toe two seconds, and I think that should work now, so change that toe two seconds. Okay, around the our application again and the now click update email. Let's add new email, for example. Example at gmail dot com. Click Update, email. Wait two seconds and there you go. Our first edit text is now changed. So that's it for this video. I hope you enjoyed watching fixing all those bugs. It's very interesting when you were working on that, and that would be all for this video. 18. Send Verification Email: hello there and the welcome back. So in my application designing adobe eggs, they I have changed the to authorities. So, as you can see in our home acuity, I have added one text view on the bottom which says I account not very fine and is considered below we can't account verified. So this text, you will be the dynamic. We were going to change that based on the account verification and inside our update email activity, we added this textually which says a cent verification email and basically, when user clicks that verification email will be sent, Toe took his email address. So now in our layout, your we went with the text view down below. So let's connect the left, right and bottom constrains so left in my constraints should be zero and bottom constraint 24. Okay, so let's ah added this text you a little bit. Change the text toe, send the verification on email or something like that. Change the text size toe 18 sp. Okay, now it looks fine for now. And of course, change the I V for our text. You copy Desailly. Because when it was the same name in our of the female activity. So let's create the text view object inside our activity. Does Bill o button here, okay, next year and find the idea in our own create method. And after that, we're going to create their own click listener for our text view so we can send the ah notification email when user clicks that text. Okay, so just down below, bellow this Abbott email conflict listener at this new on click listener. Okay. And here we went to was fibers user off it and its method named the sent email verification . So basically, with this ah, one line of court, we can send a verification email, and we're going to display a toast message saying very far verification email sent. Okay, so let's check it out. Let's look into our account. Um, our account is imaginary for is you can see our account is example at gmail dot com. So we want the first to update our email. So I'm with except my actual email address, and I'm going to click update email. Okay. And there you go. Success message user generated. So let's check our inbox to see if we could have actually received the email address, email message. So I'm going to open up my inbox now. Okay? And as you can see, there it is. So all this message title and the message body can be customized in a firebase console, so don't worry about that. Um, just the open this message. And as you can see, this is ah, before the generator of the email message with the link. So let's head over to firebase console so I can show you how you can modify your email address. Verification template. As you can see here, you can change from subject and message, and you also have a password reset and email address change templates. You can change. So for now, I will leave. That is the fault. Okay. And let me show you what will happen when you click the link in your, uh, in your email. Okay, So click this link and you will get this message. Your email has been verified, and in the next video, I'm going to show you how you can check in the wrong time. If you're ah, account is verified or not, For example, you can forbid access toe some especially specific activity account user account is not verified. And, uh, for example, you can, ah given access toe a user if he has verified its email address. 19. Check if Account is Verified: Hello there and welcome back. So in the previous video, we have implemented the scent verification email function. So I want to modify this one click listener a little bit before we can continue. And I want with the If Block so I'm going to use Ah, five is user and its method is email. Very fight, so only if email is a verified. So if email is very fight, I'm going to displace a toast message email already verified, and in else block, I'm going to send a verification email. So basically, I'm going to stop potential abuse off our application. So if your account is very fight ones, you cannot verify that again. So let's check it out quick. I get emails and click this text, as can see. We've got the toast message saying email already verified. So that's a good security fix. And now we can continue, uh, creating one more text view inside our home home activity a Zinkhan See. Ah, we're going to shave a dynamic text view So this account, not verified, will be a default value in our home activity. And I want to create two colors first for ah red and green, so you can Ah, at the any quarters we want. This is just an example. I'm going to copy the sex color code for Green as well. Okay. And now I'm going to read the text. You're here, so let's connect those constraints Left, right, and bottom, left and right, Toe zero and bottom to 24. And it's ah, customize our text view. So first changed the I d. So something like verified email test. Or maybe we should change the idea toe a verified account text. Okay. And the text should be changed. Toe count not verified. Text size should be 18 and text color to green tour. And Sorry. So this is the fourth value when when the user a sign up and logging toe omitted. And now we're going to change dynamically in home activity where we're going to track dynamically. Flower user is ah has verified his account. And if account is verified, we're going to set green collar and change the text. So let's create the new method here. We went to name this method, something like check account verification. All right, so here I'm going toe use the fibers user and its method is email. Very fight and I'm going to store. It's a result in a bully and variable. So, basically, if so, I'm going to create the block and say, Give verification is true. So basically, if our email is very fight, then we're going toe change the text and change the text color. But before that, I forgot to add this text. Do you object? So I'm going to find the idea of this text. Okay? And now we can, uh, change the text, said the text and the set a car. So he was a set text method and it will say accounts verified. And women, there was a method The set, the text color. We're going to get resource get caller, and we're goingto get our green color, so type. Ah, no, no, that are dot color, not green. Okay. And we don't need else block. We just need to call this matter inside on create method. So let's see where we will put this method. I think the best place is inside this if block So let's add a comment here so we can se set email, and I d and down below will say a check if account is verified and we're going to call our method here. Okay, So let's around application and check If the text will change and there's you can see the text has changed and we have a green collar saying account verified. So basically, you can use this toe set access to your verified users, and you can basically toe many things with this information. 20. Update Password: Ah, shoulder and the welcome back. So in this video, we're going to implement update password, the functionality for Ah, our camp. So Ah, As you can see, we have a two. Any text? One for new password. Want to repeat our password and the button to update and trigger in action. So in our object passport activity, we're going to create to wear a text, objects and the one button. Okay, so add that, and, uh, I remember toe choose the right ideas to choose the correct ideas. So Well, let's find the ideas. Okay. For new passwords for a repeat passport and for a button, of course. So we're going to add the on click Listen for our button just below this back arrow on click listener. Okay, so ah, set up Click Listener, New one click Listener. And here we're going to create the new string first, Ah, two strings for a new password and for repeat password. So my new password and my repeat password, because in those two strings we're going to store, we're going together, text and store from those two area texts. So here it was a new password that it takes together text and store inside this string and do the same for Ah, repeat password. So my repeat password Repeat best or two dogs get text to string and trim. All right. And now we're going to add if book. So if, um, my repeat password equals to, ah, my annual password. So if those two passwords I are identical, only then we can update the password and the NL's block. We can just say a toast message saying passwords don't match or Ah, basically anything else? Okay, so now we need toe create five days authentication object and five years user object as well. So it's ah, initialized that unknown create methods here. Okay. And for five days, user. Of course, because we're going through with the fibers user method toe update a password. Okay, so now down below. In on click listener in the block. We're going to have met the update password, and we're going toe pass once drink, and that's it. So, basically, with one line, of course we can of it are password that easily and even you can This if block, you can add the if a user is not know, so you can check if your user is is logging and weaken Display toast message saying a password updated successfully. So let's around our application check if that works. Fine. Okay. So, uh, now it's a click under a password button to navigate to our activity. And, ah, here, just type a new password. So our current password is from 1 to 9. And our new passwords should be, for example, for 1 to 9. And the ad 10 and 11 10 11. Okay, 10 11. Okay. And now Ah, let's repeat that password. Here, Click Update, password. And as you can see, we got the toast message saying our passwords has been updated. So, uh, so if you type around password, it will say passwords don't match. So let's ah, run our application again. And let's Taipower old password. As you can see, we get the fatal error message. Okay, so let's ah, type our new passage here. So from 1 to 9 10 11 and click science. And there you go. So, basically, we have successfully updated our passwords for five days 21. Troubleshoot: Hello there and welcome back. So this will be a short tutorial. I want to show you how we can troubleshoot your application if something goes wrong. So sometimes you might or might not get an error. He was in good fire base eso. I'm going to show you how you can fix that. So click tools and open up a five days assistance and click codification here. And if you see this message connected, that means your application is successfully connected to a fibrous product. But if you see a connected button, you need to click the button, and it will prompt your window where you can sink your project with the fireplace tow. Avoid all the possible errors.