High students it is literally all you're going to go ahead and create up an application that can actually
connect to a backend.
So our passion is going to be Firebrace.
So let me actually open the of the web browser here.
So as you can see here this is my other browser and you actually just put this address inside your address
bar in your browser.
Firebase that Google that come right.
And then you will be guided to this page.
And as you can see here we want to use this firebase in order to actually sent data to the cloud or
actually we can actually get the data from the cloud or we can often take it to users and we will be
doing all these fun stuff later.
But really we just want to send the data to the cloud.
Right.
So now as you can see here we can actually just create a gmail account.
It is necessary that you create a G-mail account and you must be signed in your Gmail account.
OK.
And then you can actually use firebase.
So in order to use firebase you can actually go to the consul here.
So just click on this go to consul here and then you will be guided to this page here.
So let's actually wait a little bit here and now as you can see here you can actually see the projects
that are actually created here.
Right.
So we can actually click click on this create a new project but we don't want to create a new project
here.
The Android studio 2.2.
OK.
It has actually capabilities in order to actually create a project and sync sync.
The project we can actually connect our app to the firebase and use the capabilities of the Firebrace
so make sure that you actually update Android studio into their newest actually version.
OK.
And you can actually open the Android studio here as you can see so as you can see the version of Mandrake
studio is 2.2.
So make sure that you actually have updated your own studio to the latest version and then you can actually
create on your project.
So just click on the start in your Android studio project and for the application name just type in
here.
Boxer data right.
So this is our application name.
And then click on next.
And here we can actually specify the minimum SDK so that the minimum is the case that you want to actually
use.
Is this what APR 19 Android 4.1 $4.40.
So as you can see here we can actually support seventy three point nine percent of the devices that
are up in the Google place that are actually active under Google place.
Right.
So now we can actually use all actually our other versions of these of these Android.
You can actually use API 9 or 10 or any API that you want but you want to choose API 1940s application
and then click on next and he has to empty activity and then click on next.
And here we can specify the activity name and the layout name and make sure that this checkbox is actually
the text and generates layout file and make sure that also this checkbox is actually checked on backwards
compatibility.
And then click on finish.
So now as you can see here it can actually create our project for us.
So it's going to set the project here.
And now as you can see our project is created we should actually wait a little bit here in order to
dig a cradle to be built here and now as you can see our project is ready.
So in order to actually use the firebase here just click on Tools at the top and then click on firebase.
Right.
And he had it because we want to actually send data to the cloud here.
Just click on this real time database database here.
Right.
So if you look at this window that is open here its name is assistance right.
Just click on this real time database here and now as you can see here we have a new button here right.
We have actually a link save and retrieve data.
So just click on this link here or button and now as you can see here this page is actually open for
us.
So now it says connect your app to firebase.
So click on the spot in here connects to firebase and now it says as you can see a dialog is opened
and it says start connecting to Diala is kinda like right.
So let's actually leave it here.
So it's gonna connect this app our application box or data to that firebase.
So if you are actually using this feature for the first time it's going to actually open up your browser
and it's going to actually ask you to allow the firebase to actually access some of the data of your
account.
And then it says create new firebase project and it says you can actually specify the actually the regions
to make sure that the app name here is the same as your name here.
Box or data.
So don't change the value here and here make sure that this checkbox is checked.
Create new file based project.
It is very important and you can specify the country or region here and then click on Connect to Firebrace.
So it's going to actually start creating the project this firebase project for us in the cloud.
So you don't have to do anything here.
OK.
You just have to wait a little bit here.
So now as you can see here it says firebase project created and connected to locally to match your app.
OK.
So we have successfully connected our application boxes data to the firebase.
Right.
So now as you can see here we have this value in green.
It says connected OK connected.
So we have now we need to actually do that the second step.
And it says at the real time database to your app.
So because we want to actually use this realtime database here we need to actually add this realtime
database to our application.
So just click on this at the realtime database to your app.
And here are daylight opens as you can see here and we need to actually click on accept changes.
So it's going to actually add some lines of code to your grade files.
So let me tell you that we have two types of great files.
We have a project level cradle file and we have an applicable grade of white.
So now as you can see here inside this project structure we have this part in here we have these two
little triangles.
If I click on them here we have actually some views.
So just click on this project view.
And now this is our project view right.
And if we actually open this folder or a box of 8 or we have this built that the cradle file which is
actually inside this box or data.
So this file is called Project Libelle built that cradle fight.
And now as you can see here we have this app file there and if we open it as you can see we have this
inside this app folder we have this build that cradle file which is actually called app level cradle
built that great white.
So now as you can see here we have a new file inside this for the Google dash services that Jason.
OK.
This file is either by the Google this by the Android studio so that they can actually use the Firebrace
in our application.
So you don't have to worry about this here you don't have to worry about the speed that cradle here
because all the codes are actually added automatically by the Android studio for now.
Let's actually open our activity underlaid minute example here and then let's actually click on hello
world here and and press on the key on your keyboard.
And now let's actually drag up the text field.
So as you can see here inside these text fields there we have this plain text here right.
So just select it and just put it here.
As you can see here we have this relatively out.
So just put it at the center and then here let's actually drag a button.
So inside these widgets whether we have this button to just select and do like it here below this textfield.
Right.
And then so just select is textfield here.
This edit text.
And for the ID just type in EDT value right and then person entity on your keyboard.
And then here as you can see we have this text attribute of this text field.
So it does name value here and now.
So select the spot in here and for the ID just type in here PTEN scent value to server.
So this is the ID Beati and sent value to server.
And for the text that just typed in here sent data to server and that person enter here on your keyboard.
And now let's get you to go inside this main activity that double file here.
And inside is uncreate effectless actually create two objects that we need to create in order to interact
with the user interface components.
So as you can see here the first object is actually a textfield right.
So now let's actually go inside this main activity the audio file and that's just a reverse of the name
of these text class.
So it is text and the name of an object is going to be EDT.
Value assignment operator.
And then I need to cast this object to a it takes object find view by ID or that Id dot EDT value and
then put a semicolon at the end of your statement.
And now let's actually create an object of type BOTTEN so potent.
The name is going to be between sent and send data to a server and then put an assignment operator here.
And then let's actually cast this object to a button object find view by ID or thought Id dot between
cint value to server and then put a semicolon at the end of your statement.
And now let's actually first with the name of our variable which actually holds this instance.
So as you can see here we have actually a variable which is of bottom right and this variable holds
this Potten instance right.
So now we can actually refer to the name of the Spot an object or instance PTEN sent data to a server
that said unclick listener.
And then just put the value new and then just put the letter capital V.
And now the autocomplete feature of the Android studio is helping me to choose this option unclick listener.
And if I actually choose this option here as you can see inside the curly braces it is dot dot dot.
So choose this option here and then present into the key on your keyboard.
And now it's going to automatically put these lines of code here.
Right.
So now as you can see here we have actually an anonymous inner class here that actually implements this.
Unclick listener interface.
And because that anonymous inner class implements this unclick listener interface we must actually provide
an implementation for this uncle it that is inside of his uncle uncle Ackerson an interface.
So let's actually go inside the curly braces of this uncle Comerford and first of all we need to actually
create our reference to our database.
Right.
So now let's actually open our web browser here and now let me actually just refresh this page here
because we actually created an application in Andrew's studio and we connected that application to the
fireplace.
So if I now actually just refresh this page here it's going to show me the application that is created
here.
So as you can see here we have these boxes data application.
Right.
This application is actually created here for me automatically by the Android studio.
And firebase So if I actually click on this application here this project.
So just click on it.
And now this is our project right.
So now we can see these panels.
We can see these options and here because we want to just send the data to the database for this application
later we will be actually creating more and more complex applications by using a firebase But for now
we just want to send it to the server.
So we want to learn how to do that.
So just here as you can see in the left hand sidebar as you can see we have this database option here.
Right.
So just click on it.
And now as you can see which we have this real database here right.
And we have some taps here.
They tell rules usage backups.
So just click on these rules here as you can see inside this data here in this data page.
We have these values and this is our database this is going to be our reference to our database so we
can actually use this instance in order to actually create our own objects.
But for not just don't think about it here as you can see we have these rules pop here right.
Just click on it and now we have this is actually based on data.
And now it says that Threet colon and insert the codes it says off is not equal to NULL.
And we have this dot right colon.
And instead of double quotes it says all of is not equal to a lot.
And it says that if the user is not actually authenticated if the user is not registered as the user
of the application that user is not allowed to actually interact with the database.
So we don't want to actually authenticate here because I'll talk more about authentication later.
We will be actually creating an application in order to have any authenticated user.
But for now we just we don't want to authenticate.
So just delete these exclamation mark here and put another equal operator and again delete these exclamation
marks here and put another equal operator and then we can publish here as you can't see.
So let's actually wait a little bit here and it says rules published.
Right.
So let's go back to that date tap here and now we want to actually send the data here and we will be
watching the data here.
So let's actually go back to android studio.