High students in this theater all I want to show you how you can manually add the firebase to your project.
So now lisc actually create a test project.
So just click on this.
Start in your Android studio project and for the application name just type in here.
Test firebase.
And then here you can specify the company domain package name and the project location and then click
on next.
And here are choose API 16 Android 4.1 Jelly Bean for the minimum SDK and the next.
And here is empty activity next.
And here just don't change anything.
And then click on finish.
So now it's going to actually create a project for us.
So let's wait a little bit here.
So in order to manually connect our application to the firebase database first we need to actually open
our browser and then here as you can see I actually entered this you r l firebase that Google dot come
and here just click on these button get started for free.
Right.
Just click on it and then it's going to actually guide us to our page that actually allows us to create
a new project.
So here let's wait and now as you can see here this is our the concert area.
And here as you can see we have the spot and create new project.
So just click on it and then here can specify the project name.
So here I can say test firebase.
Just name it whatever you want.
And then here you can specify the country or region and then click on create create project and now
as you can see it actually guided us to this page.
Now it says welcome to firebase get started here.
So now just click on this at firebase to to your Android app.
Right.
Just click on it and now first we need to specify the package name.
So let's actually open our Android studio.
So in order to find out the package name as you can see here in this area you can see these these two
little triangles here.
Just click on it.
And here we have project packages scratches and Android just the selectees Android and here inside this
app fall there.
We have this double fold that just opened up a folder and inside is double folder we have this package
right.
And the name of this package is for example the mine is come that example that mortars I saw that that
has firebase.
So this is my packaging.
So I just need to put this package name here.
Let's open our Web browser.
So far the package name here I can see can that example.
So you need to put your own package name here right that more has a soldered that test firebase as you
can see here this name must be the same as the name of our package.
Right this is very important and that here for the apt nickname which is actually optional.
You don't have to put a nickname here for your application but if you want to just put a name here and
here it says D-bag signing certificate s h a dash 1.
This is also optional but it's better to put are actually debugging D-Backs signing certificate here.
So let's open our studio and here at the right hand side we have this cradle here.
Right.
So just click on this a great deal here and that here inside is it test firebase.
We have this one test fired by Strood just opened it and here inside is testifying today Struth.
We have these tasks folder inside these tasks folders we have these Android folders to just open this
android folder.
And then here just double click on this signing report.
So here as you can see here at the bottom it says test fired by signing report.
And if you can't see here this code is here as you can see we have this is each one here right.
So this is the code that we actually must copy and paste pasted it there.
Here inside is our field.
So if you can't see actually this code as you can see we have this button here it says Tuggle tasks.
Execution right.
Just click on it.
And as you can see here we have these values here.
If you see these values here you just need to click on these tasks toggle has a Tuggle tasks execution
and then you can see these codes here.
So just copy this code here and then just if you are using a Mac you just need to hold the command key
on your keyboard and then press on the leaders key on your keyboard.
So let me actually highlighted here and if you are using our windows machine you just to hold the control
key on your keyboard and then press on the letters CC on your keyboard.
So let's actually open our Web browser and here inside this field.
I just need to paste this value and then here click on Add app button.
So now let's actually give it a little bit here.
And I was going to actually download this Jason File here automatically.
So as you can see this Jason fight is actually downloaded here automatically right and now it says switch
to the project view in Android studio to in Android studio to see your project root directory.
So let's open our Android studio and here in this area.
Now let me actually double click on this tab here.
Main activity that Java and here are let's actually click on at the top click on View tool windows project.
Right.
And here in this area as you can see we are inside the Android view right now.
I want to actually search through the project view this is really important.
As you can see here it says switch to the project view right.
So let's go back to what I understood you here as you can see we have these two little triangles.
So just click on them here and click on Project.
And now this is our project view.
Right.
And here it says move that Google Google dash services that take some file you just downloaded into
your Android app module root directory.
So the Android app model directory is this one as you can see here this app for this app directory right.
Just open this app the rectory here and now you just need to just move that download file to this folder.
So let's see how we can do that.
So I have downloaded that some file into my downloads folder.
So let me try to open that folder here.
As you can see this is my folder Downloads folder.
I just need to select it and just and just drag it here into this app folder here.
Right now it's going to actually show us this dialog.
And here I just need to click on OK.
Right.
Just click on it and then here.
OK.
Now that file is inside our app module directory.
Right.
And let me hear let me point out a very important point.
First let's actually at the top click on Android studio and now A123 to open the Android SDK manager
right.
So just click on Android studio and then here click on if you are using a Mac you just need to click
on Android studia and then click on preferences.
Right.
And if you are using a Windows machine or you that you just need to click on a file and then click on
settings or preferences and that here or click on preferences.
And now as you can see at the top it says appearance and behavior just open this one here and here as
you can see we have this system settings.
Just open it here and then click on Android SDK.
And here at the bottom it says the launch standalone STK manages to just launch this one here and here
make sure that you have downloaded the latest Android SDK tools and Android SDK platform tools.
Right.
And now as you can see make sure that you have actually updated to the latest version of Android API
as you can see I have this one android 7.0 API here API 20 24 and I have actually the latest version
of my SDK platform and Google API.
And as you can see here inside this let me scroll down here.
Inside these extras for there I have actually the latest version of Android support repository.
This is really important if you want to actually use firebase for your Android apps.
You must actually update your Android support repository as you can see here.
And as you can see we have this Google repository.
So you must actually also update your Google repository to the latest version.
This is really important and Android support Android support repository and Google Support repository.
These two packages are very important to be updated.
So now let me ask you to close this window here and let me close this window here.
So as you can see here I have the states on file inside my app directory right.
So let's go back to our Web browser as you can see here.
We actually just moved our Jason File to an app directory so this click can continue.
And here it says the Google services plug in for greater loads the Google dash services that Jason find
you just download it modify your belt that greater voice to use the plug in.
So first of all you should do.
You must do this step here.
It says project level build that cradle.
So let me show you the project level piece that cradle.
So let's go back to our Android studio and here as you can see we are inside the project view.
Right.
And we have to build that grade of files here inside our project.
The first one is inside this app directory which is called app level bill that cradle here as you can
see here.
And the second file is inside is pro-tax directed and it is built.
That's great right.
So it is called Project level build that cradle fight.
So let's go back to our web browser and it says project level that great and fight right.
So here let's actually open our project level build that grade and find just just double click on it.
So let's go back to it and go to our web browser and here it says just add this line here inside of
the dependences block.
So let's actually copy this line here.
Just copy click on a copy here and then let's actually go back to our Android studio.
Let's actually find the dependences play as you can see here.
Inside are built script Glutch.
We have this dependences block.
So Enceladus dependencies bludge as you can see.
I just need to paste this code here.
So let's go back to our web browser and now we should do the second step.
And it says applicable.
Build that great.
All right so let's go back to our Android studio.
And now let's actually open our app directory and Enceladus is absolutely just double click and dispelled
that great deal here.
So this is actually are.
Apple will beat that.
Great.
All right.
So let's go back to our web browser and here it says at the bottom of the file.
So just copy this line of code here.
Just copy and let's go back to our Android studio and here at the bottom of the file as you can see
here inside our bill that great file.
This is that is actually inside these abstractedly at the bottom just paste disvalue.
And here at the top it says sinch now right.
Just click on it.
And now we going actually see our project.
So let's actually a little bit here and it's going to actually set up our project so in this way we
are actually connecting to the Firebrace.
Right.
So let's go back to our web browser and it is finally sync now so we already synched our project.
And then here click on finish.
So now we successfully connected our application to the firebase.
Right.
So this is I should imagine this is how we can manually connect your application to the firebase.
But if you want to automatically connect your application to the Firebrace since you just click on Tools
at the top and then click on firebase on here you can easily just click on this for example a realtime
database.
So here we want to use this word right and then click on Save and retrieve data and you just click on
this button.
But we already are actually manually added in this application to our firebase.
And here it says connected.
Right.
So we don't have to use it here automatically.
So now let me actually collapsed this assistant area.
So let's go back to our web browser and here for example I want to use the database here right.
So just click on this database here and then here we have these tabs here at the top just click on these
rules tab here at the top.
And now let's get you to change the rules.
So here.
Let's actually just delete this exclamation mark here and put up and put an equal operator and that
here.
Just delete these exclamation marks and then put an equal operator here.
And then here just click on publish.
And here it says rules published.
So let's go back to our date our top here.
Just click on date or tab.
Now let's go back to our Android studio.
And now I want to actually use the database right.
So let's go back to our web browser and here it says store and synch data in real time across all connected
clients.
So here just click on this.
Learn more here.
So now let me double click on it.
Right click on it and then click on Open linch a new tab.
So now it's going to actually guide us through the documentation.
Right.
It says firebase realtime database.
So here at the left hand side choose Android and then click on get started the database and it gets
started.
And here we actually install the firebase SDK already Vinney to actually add the one more line of code
here.
As you can see it is at the dependency for firebase real time database to your app level build that
great deal.
This is important because I want to use the database here the firebase database are a must actually
add this line of code here to my bill that great a file that is inside of the app directory.
So just copy this line of code here just select it and then I click on it and then click on copy.
Let's go back to our Android studio.
And then here as you can see we need to go inside the app directory here and just click on this.
That a file that is inside of this app directory so just double click on it is built that cradle file.
And it here as you can see.
Let's go back to our Web browser and it says add that dependency.
Right.
This is really important.
It says dependency.
So let's go back to our Android studio.
So here we have these dependencies Blatch.
Right.
So inside these dependences plug as you can see I just need to paste this line of code here compiled
and here you can see disvalue for firebase database.
And that he had at the top it says sinch now.
Right.
Just click on it.
So let's actually wait a little bit here.
And now as you can see here it's going to actually just make our project ready for using firebase database.
So let's actually wait a little bit here and now our project is ready.
So now here at the left hand side in this area let's actually switch to the Android view.
So just click on this little triangle here and then click on Android.
And now as you can see here inside this app directory if you have this double and inside the subfolder
we have this package.
So inside this package just double click on this main activity that Jobvite right here and inside this
class and inside is uncreate Smurfette.
I want to actually test my firebase database.
So here I can actually create a firebase database instance.
So firebase database database assignment operator.
And here I can say firebase database that get instance and then put a semicolon at the end of your statement.
And here let's actually just create a file based database reference.
So here just type in database reference and here I can say database offense assignment operator.
So here I need to refer to the name of this database so database that gets reference.
So it's going to give me a reference to the firebase database so let's go back to what the president
here as you can see this is our firebase database reference so here I have the reference to this note
as you can see here.
Right.
So now here I can actually set a value.
So here I can say database or France data set value for example or something.
And then I need to put a semicolon at the end of my statement.
So now let's run project and see what happens.
So now as you can see here our project didn't run right.
So that's because we actually copied this code.
We did something in order to copy this s h a 1 code.
Right.
So at the top as you can see here beside this the run button here.
Here it says just firebase and inside the brackets it says signing a report.
So just click on this one here and here just click on app right.
Just click on this one and then click on app.
And now our project is ready to be run.
So just could run but now run up and then choose an emulator in order to run your application on and
then click on.
OK so now let's actually wait a little bit here let me show you the the emulator.
So now as you can see here our application is actually running on this emulator right.
So let's go back to our web browser and now as you can see here we have this value here or something.
So we managed to successfully connect our application to the firebase database and we managed to actually
manipulate data here.
We managed to actually set a value to our note here.
So I think that's enough for this tutorial so if you have any questions about these concepts that might
hurt you in this listen please post the discussion in the course and then I'll do my best to answer
all of your questions.
Thank you very much for watching and I'll see you in the next Tauriel.