All right.
So now that you've built and tested the 'I Am Rich' app on a emulator or a simulator, it's time to try
and run it on a physical device.
So, if you have a physical Android device and you would like to test your app on it, then follow along
with this lesson.
And that's exactly what we're gonna do.
Now if you don't have an Android device, you can skip ahead to the next lesson where we show you how
to test your app on a physical iOS device.
All right.
So there's quite a few steps that are involved in order to successfully be able to connect our Android
device with the computer.
And I'm going to walk you through them step by step.
And it's really important that you do them in the order that we're showing you here.
So the first step is you're going to go into your phone, and you're going to enable developer mode.
So you're going to go into your Settings, and go on to About, and you're going to somehow locate something
called your Build number.
Now, on this HTC device that I'm showing you right here, it's under About, and then it's inside Software
information.
And then we have to go into More, in order to discover this thing called Build number.
Now once you've discovered Build number, then you have to start tapping on it. And you're going to get
a popup that tells you how many steps you are away from being a developer.
So keep tapping.
You have to tap a total of seven times before you get to join the secret club of Android developers.
And now when you head back to the main settings, you'll get a new secret menu appear which is Developer
options.
And here, you have to make sure that USB debugging is enabled and click OK
when it prompts you.
Now once you enable USB debugging, this will allow your phone to be able to communicate with your computer.
Depending on your phone make and the operating system, the version of Android that you're running,
you might see a different user interface.
So the Build number might be located, for example in this other Nexus device I've got here,
you'll find the build number under Settings and under System and About. And it's here where it says about
phone, that you can locate the Build number, which is the place that you have to tap on.
So you might have to hunt around a little bit for this thing called Build number.
But you can also have a quick google and find out for your version of your Android operating system
and for your phone, where you can locate this Build number.
And once you found it, tap it seven times to enable Developer mode, and then you'll be able to enable
USB debugging.
It's a bit of a treasure hunt if you will.
Now, once you've successfully enabled USB debugging, then the next thing is to connect your phone to your
computer with a USB.
And strangely, this is one of the most common downfalls for students who are trying to test their device.
Because, not all USB cables are equal.
And some USB cables will only transfer power and not data.
But of course, we need both power and data to be transferred.
So ideally try and find the original cable that came with your phone. If not, make sure you've got a proper
cable made by somebody decent.
Now, once you've connected your phone with USB, what you should see on your phone is a prompt.
So head over to your phone and take a look at the screen, and see if you have this popup asking you
whether if you want to trust this computer.
Now it's really important here that you check the box where it says always allow from this computer.
So you don't have to deal with this popup every time you want to run your app. And then go ahead and
click OK.
So now, you've trusted this computer to receive data from it into your phone
and we're finally ready to actually run the app from Android Studio. So here on the right, I've got my
physical device showing,
and here is my Android Studio.
And you can see that after completing all of those steps successfully, I can actually see my device listed
in this list of drop downs.
And it's now ready to receive my app.
So go ahead and make sure it's selected,
then click on the play button.
And now the app's been built, and it's now going to show the app on my HTC One physical device.
And there it is. Success.
We've managed to get our app loaded onto a physical device and showing on our phone. So if you're using
a Google phone such as a Nexus or a Pixel,
this usually is a pretty straightforward task. But if you're using a phone from a not a well-known make,
then we've seen students encounter a lot of problems along the way.
So if it is not working for you, and even after going through all those steps that I mentioned, step by
step, and you still don't see your phone show up right here, then head over to the court resources under
this module, you'll see a link to a troubleshooting document. Where we've listed some of the things that
could go wrong and ways of solving it.
But hopefully for everybody else,
this should now be working.
And if you have a computer that's maybe a little bit older and running the emulator is extremely slow,
then you might want to consider simply running the apps onto your physical device every time.
Because now your app doesn't require the computer and all it has to do is to send the package of code
to your phone and your phone can use its resources to render the app.
So that's another tip.
Now on the next lesson, we're going to show you how to run your app onto a physical iPhone device.
So if you want to be able to do that, then head over to the next lesson.
Otherwise, you can skip ahead and continue to build our next app.