Right now we see a picture of a phone but this isn't actually on our phone.
This is pretty similar to when we were working with the XML visualizer.
Now we actually want to see our app on our phone.
To participate you're going to need a USB cable like this.
Now, this USB cable should fit your Android phone but you will also need.
What do I mean by fit well, I could pick up my phone and plug this cable into it.
Now, if you don't have these things there's a slightly more complicated way
you could get up and running, which I'm going to talk about in the next video.
But if you have both of these items,
I really encourage you to use a real device.
It's a lot more fun that way.
All right.
First things first.
Your phone is not set up to let random code from your computer right on your
phone by default.
So you're going to need to do a few steps to prep your phone.
Okay. So the first step is to become
a developer.
This sounds a little funny.
When will you know when you're a developer.
Well what this actually means is changing around a couple of settings on
the phone, which will allow you to access developer options.
Once your phone's set up, you'll connect your phone to your computer
using the USB cable that I talked about before.
Now if you're using a Windows machine, the third step for you and
Windows only will be to install a driver.
And the driver's an extra little bit of software that will allow your
phone to communicate with your Windows machine.
With Macs, this just works by default, so you don't have to worry about it.
And finally you'll install your app.
All right let's start doing these steps.
On newer phones running in Android 4.2 and
later, you need to tell your phone that you're a developer.
This is a pretty simple process I'll show you right now.
The way to do this is to navigate to the settings menu.
Once you here, scroll down to the bottom and click on about phone.
On this menu also scroll down to the bottom.
You should see something that says build number.
Okay so take the builder and click it seven times cool.
So now suddenly your developer, wasn't that easy.
Once you're done go ahead of the back button.
Okay, now in developer options there's a bunch of fancy sounding options but
what I want you to do is scroll down until you see USB debugging and
then go ahead and click will check box next to USB debugging to turn it on and
say okay by checking this box it's allowing your computer to put
applications onto your phone.
Awesome.
Now that you've enabled that you can take your handy dandy USB cable plug one
end into the phone and take the other end and plug it into your computer.
If you're a Windows device there's one more step to set up your phone
and computer.
Your Windows machine needs some software called a driver
to communicate with your phone.
I'll start by downloading the driver.
For most phones besides Google Nexus phones,
you could navigate to the android OEM which stands for
Original Equipment Manufacturers driver website.
[BLANK_AUDIO]
A link is provided in the instructor notes.
I'm going to scroll down to the bottom, here I've a list of drivers for
different phones and I'll go ahead a double at the appropriate one.
In my case I have a Nexus phone so
I'm going to go up on the page and click Google USB driver.
This is, again, for Nexus phones.
Okay, so for me, I'm going to go ahead and download the Google USB driver.
[BLANK_AUDIO]
Unzip it.
I'm going to move this to my desktop.
So at this point I've downloaded the driver,
I've unzipped it, and I put it on my desktop.
What you need to do next is double check that your phone is actually plugged in.
Okay, let's look at our Taskbar.
I'm going to click on the Start Menu and go to Computer.
In Windows Explorer, I'm going to right click on the word here that says
Computer and then I'll go to Manage.
In this left pane here I'm going to select Device Manager.
So looking through this list, go ahead and
find the thing that says other devices and expand it.
Now you should see something here that refers to your phone.
For example, Nexus S.
or A D.B. which stands for Android Debug Bridge interface.
Okay, so I'm going to right click and select update driver software.
This is going to launch a wizard that looks like this and
I want to select the one that let's me browse my computer because remember I
just downloaded it to my desktop.
So I do browse computer and I'm going to go ahead and click browse and
going to my desktop and hit OK and hit next.
I might see some security messages like this go ahead and say install.
All right, cool.
So, this autoplay just popped up with my Nexus 6 so
that's a good sign that now the computer is communicating well with my phone.
I'm going to go ahead and close this.
And the final window of the Wizard says that Windows has
successfully updated your driver software so that sounds awesome.
I'll go ahead click close.
Basically at this point your phone's ready to accept the application
from your computer.
Another way of saying that you can now install apps that you've built on your
computer onto your phone.
Finally we're going to install our hello world app from the computer
on to the phone.
To do this you're going to go up to the top of Android Studio
to this green play button and click it.
It will take about ten seconds or so for the next window to pop up so
be patient at the bottom of the screen
you should be able to see that there's some process being executed.
Now if everything went as planned your computer should detect your phone and
listed here.
Make sure you have the chooser running device radio button clicked and
not the launch emulator radio button selected.
If you can't see your phone try unplugging it and replugging it in.
And then try restarting the phone.
If that also doesn't work and
you're on a Windows machine, you might have installed the wrong driver.
If none of those solutions seem have solved your problem,
we've created a troubleshooting document which is linked in the instructor notes.
And you can always try asking your fellow students for help on chat or
in forums.
Okay but hopefully things are working.
You can select your phone and click the OK button.
After about five seconds, you should see your phone looks like this.
You've now successfully run your first Android application on a phone.
Awesome work.