Alright, so we're all ready to start
writing apps for Android, but we should
probably start by answering the question
"What is Android?". Now Android is often
considered to be an operating system, but
it's also a software stack that consists
of an operating system, Linux, and a
framework for developing applications.
And it also includes a number of key
applications, such as contacts, that
reflect its purpose as a mobile platform.
Android was originally written by a
company called Android Incorporated, and
Google bought that company in 2005. Now
it's usual to think of Android as being
developed by Google, and I tend to talk
about Google a lot in this course, but
Android is in fact maintained by
the Open Handset Alliance. So rather than
releasing Android as a proprietary
system when they bought Android
Incorporated, Google got together with a
number of other companies to create the
Open Handset Alliance. The OHA. Now at
the time I'm recording this video, the
OHA has 84 members who are all committed
to keeping Android open source. So you
can actually download the complete
source code for Android, and modify it, if
you wish. There's actually a link to get
the source on the home page of the OHA.
I'm just going to bring that link up on
the screen there; again OHA, Open Handset
Alliance. You can see there's an option
there to get the source code. There's
also a link there to get the SDK as well.
Now the home page is a little bit
misleading, because the most recent entry
in the what's new section, over here,
actually has a date of July 18th 2011.
And that would give the impression that
not much is happening with the OHA, but
that couldn't be further from the truth.
You're taking this course, so you
probably know that version 8 of Android,
code named Oreo, was released in 2017. A new
version of Android is actually released
every year.
Android and the OHA are very much alive.
Now you can learn more about the OHA by
clicking on the Alliance menu item, at
the top of the page. Clicking on
Members, as I've done there, shows the
current members of the OHA; and if you
scroll down, if I scroll down, you can
probably recognize some of the names of
these companies. They're
actually part of the OHA. And there's
different categories here. What we
chose with the default is Mobile
Operators. Handset manufacturers - some
household names here for sure.
SUSE Tech is one, Dell is another,
Jitsu, so some quite well-known companies.
NEC, LG and so on. Now I'm not going to
spend time in this video going through it,
but the Android menu also is well worth
a read, to get an overview of the
thinking behind Android. Now I suggest
that it might be useful for you, if
you're on this page, to actually watch
this video. It's quite a useful video and
have a bit of a read there. All right,
so let's have a quick look at Android, to
see some of the things that we're going
to be looking at getting our apps to do.
Now for this demo we're going to be
using an Android emulator, or virtual
device, and we'll be looking at how to
create virtual devices a bit later in
the course. But think of them as so
basically a way to run our apps on a
wide variety of phones, without having to
buy loads of devices, because it's all
actually done in a virtual machine.
Which means it's running on your
computer. Now in fact, when Google
released Android studio 3, they also
updated the emulators. Now there's also a
couple of emulators that include the
Google Play Store.
and what that means is that you can
install just about any apps from the
Play Store onto your emulator, and we're
going to be discussing that in more
detail when we come to create our own
emulators. But it's something that
developers have been asking for for
quite a few years now. Alright, so I'm going
to switch over now to an emulator - you
can see that I've got it running, but we
can see that it looks like a real
Android phone. There at the bottom are
these three soft keys, and you
find those on just about all Android
devices these days. Though some
manufacturers do replace the middle
button with a physical key, rather than
having it on screen, but the function is
the same. Now the triangular button on
the left over here, that's the back
button, and some devices that appears as
a curved left pointing arrow, and
rather confusingly can appear on the
right-hand side of the screen instead.
The back button, though, is used to go
back to a previous app, dismiss
dialogues, cancel menus; basically it just
goes back to what you were doing before.
And just to see what I mean there,
I can come over here and click on it, to get into our list of
apps. I can choose Gmail, then I can
click on the back button to go back to
the list of apps. Now the middle button
down here, that's the home button, and as
I said some manufacturers use a physical
button for that instead. And this button
takes you back to the home screen. So if
I run Gmail again, and then press the
home button, we end up back on the home
screen, rather than the apps list that we
got when we clicked on back. Now it's got
another function - if you long tap, so
hold it down basically, it'll launch the
Google app: you can see that that's come
up there when I've done that. Now I don't
want to set up the Google assistant at
the moment, so I'm going to click on back
there to get out of that. And we're going
to need another app running for this
next bit, so I'm gonna launch Google Maps
as well. So I'm just going to go to the
home again, click on maps here, and open
up Google Maps as well. Then the square
button on the right, over here, has
various names. You'll find it referred
to as the recents button, or the
multitasking button, or even sometimes
the intents button. Now before I tap it,
one thing that may not be obvious is
that pressing back or home doesn't close
an Android app in the same sense as
closing a program on your PC. The app is
still running, and you can bring it back
to the same state it was when you
dismissed it.
Now the recent button shows all the apps
that are still running, and if I click on
that now, so you can see here that I've
got maps going, as well as Gmail. And you
can actually close it up completely by
clicking on the X up here, at the top
right. But Android will actually take
take care of closing the older apps for
you, if it needs to use the memory for
something else. So there's generally no
need to do that. What I'm doing instead
is tap Google Maps.
When I do that, it brings it to the
foreground. Then you can scroll through
the list of recent apps, so well to
demonstrate that I need a few more apps
running, so we've got a decent list to
scroll through. So I'm going to go back
to the home screen, using the middle
button, and go into apps, and we'll start
by launching calendar. Now back will take
me back to the list of apps, and this
time we're going to select photos.
That's a bit boring because I haven't
got any photos on this emulator. So I'm
gonna go back one more time now, this
time we're gonna start the YouTube app.
Okay, so we've now got a few apps running,
and I can view them all by tapping that
- recents button again. They're all the
apps I've just launched - stacked up with
the most recent on the top of the pile.
You can see on the bottom that's
YouTube. Now this is much easier to do on
a physical device. Using an emulator will
take a little bit of getting used to,
because the mouse pointer doesn't quite
behave the same as a finger on a
touchscreen. And hopefully I won't
accidentally touch an app while trying
to scroll through them. But the way to
scroll through them is to to hold the
mouse button down while moving the mouse,
to simulate a finger dragging. So if I do
that, you can see here that I can
actually move down and change the list
of apps, as I scroll down, or scroll up
for that matter. I'm getting the
different apps as I do that.
Basically it's simulating the finger
dragging of the phone's touchscreen. Now
you saw that when I was dragging, the
recent apps move off the bottom of
the screen, to reveal the older ones.
Like so. If I start down there, then as I
scroll up you can see Photos is coming
up, YouTube, and so on. Now the Linux
kernel allows multitasking, and Android's
built on top of the Linux kernel. So an
Android phone is a multitasking computer.
And you can have actually have several
apps running at the same time, which
we're doing here, and this can be very
useful if you need to do something like
checking your calendar while talking on
the phone, for example. And in fact we can
simulate that. I'll select Gmail from the
list of apps, so I'll scroll down, click
on Gmail. And next I'm going to phone my
emulator. Now at the bottom of the side
menu, over here, is this ellipsis - three
dots. If I click on that, that brings up
an extended controls; which I'll just
move over, so you can see the screen as
well. This the menu lets you play around
with things like location and text
messages. Now the phone option in the
left pane, over here, I click on that ... that
allows me to send SMS messages to the
phone and you can also simulate an
incoming
phone call, using the call phone button.
And you can even enter different phone
numbers, to build up a phone log, which
can be useful if you're testing an app
that works with the phone log. Now on
this Nexus emulator, that causes a
message to drop down so that I can
answer the call. Let's just do that.
call device, you can see that's popped up
there. I've come over here now onto the
device. I click on answer.
Now you can't really have a phone
conversation with the emulator, but the
emulator is now behaving like a real
phone that's in a phone call. So without
hanging up the phone, I could tap on the
recents button go back to my email, and
view that. Now there isn't much in this
email, because I'm using a test account
for this demo, but it can be useful to
check some details in an email during a
phone call. All right, so now that I've
checked my email, I can tap the recents
button again, and go back to the phone
call. And obviously if that was off the
list, we could scroll up and down to find
it. And just click it to actually bring
that back on screen again. So that's
pretty neat. The Android phone that fits
in your pocket is more powerful than most
desktop computers from just twenty years
ago. Now there is a slight oddity
sometimes with simulating phone calls on
the emulators. At the moment, when I tap
the red floating action button down here
during the call, the extended control
menu sometimes doesn't seem to update. It
thinks there's still a call in progress.
So tapping the button in there will end
the call, but in this case that has
actually worked okay, but if you get a
problem there, just tap on the button
over here, to end the call. It's not
really a big problem, just something to
be aware of when you're testing how your
apps behave when something like a phone
call happens. Now the phone app, by the
way, doesn't appear in the recents list
after you end a call. So when I tap the
recent button again, you can see that
it's actually disappeared. There's only
the apps I had running before the
phone call came in. To get back to it, we
need to tap the home button, click on
the blue phone icon here. Now I
haven't got any favourites saved, but the
middle tab, this one here with the clock
icon, shows the time and duration of the
you know quote-unquote call I just
received. And I can even simulate an
outgoing call by tapping the phone icon
on the right over here, and that
simulates, as I said, an outgoing phone
call. Of course we're not really going
to make a phone call, but it's a great
feature, again, when testing your apps.
Alright, so I'm going to hang up the phone,
let's hang up that call now.
Let's have a look at split screen mode. Now a
new feature that was introduced in
Android 7 Nougat is split screen mode.
As I said, don't worry if you haven't
got an Android 7 or later device. All the
apps we're developing this course will
run on all devices, on Android 4
- that's Android Jellybean - onwards. They
won't be able to use split screen mode
on earlier devices, but it's still useful
to see what it is. Now some
Samsung devices have had split screen
for a while, but it's now part of Android
itself, which means that all devices from
Nougat onwards will be able to use it.
Now you need one app already running, to
go into split screen mode, and I've
already got the phone dialer on the screen.
So we'll use that for this demo. Now with
that running, which it is, I'm gonna long
tap over here, on the recents button, and
again, on a phone, you'd be holding
your finger on it. In the emulator I
just held the mouse button down, until
that happened. Now on phones that've
got soft buttons, rather than physical
devices, the icon changes to show you
that you're in split screen. So instead
of just a square, it shows two boxes
inside the square, to represent the two
apps running. And that's what you can see
down here. Now I can scroll through the
list of apps down the bottom now, and tap
the one that I want to open in that
other half of the screen. Again I can just
come down and select them. like so. Now
some apps can't support running in split
screen, so you may see a message over
those apps informing you of that. But I
can scroll down and select, for example
the Gmail. Click on that, and I can have
that and the dialer running together on
the device, on screen at the same time. So
yeah that's pretty neat. And it's also
possible to copy and paste between the
two apps, but not all apps actually
support that. Now the bar in the middle
here looks like it lets you resize the
apps, but at the moment anyway it's just
used to close one or the other, by
dragging it over the app you want to
remove from the screen. So I'm going to
drag it to get rid of the dialer, so
we're left with just Gmail. So we're back
in single view mode. So we've now got the
one app running, and the recents button has
now changed back to the single square
again. Okay so let's have a look at some
of the things we're going to be learning
how to add to our apps. Now at the top
of the Gmail app is a toolbar, with a
settings menu on the left, and a search
button on the right. So there's the
settings and there's the search. The
settings menu, as I click it, produces
a navigation drawer. And in this course
we'll see how to create these, as well as
implementing search in our apps. Now to
dismiss the navigation drawer, swipe
to the left.
Now some older phones have a physical
Settings button, instead of the settings
3 bar icon appearing on the toolbar.
It works in the same way, just be aware
of that, if you create an app and the
settings icon doesn't appear on the
toolbar. Now it's also possible to have a
more traditional menu on the toolbar, and
we'll be learning how to create menus
before we get into navigation drawers.
Now the brief instructions at the top of
the list of emails looks like a snack
bar - this one here. These were introduced
with Lollipop and material design, but
are available now for all Android
versions - dating right back to version
2.1 And they're similar to the toast
messages that pop up briefly on the
screen, but you can also add actions to
them, which makes them more interactive
than the old toast messages. This one has
just a simple button to close the snack
bar, but you can also swipe them off the
screen, like so. Now, the emails appear in
a list, and we can create lists like this
using either the ListView widget or a
more recent replacement, called a RecyclerView.
Now, the RecyclerView is more
flexible, but you can't tell by looking
at the screen which one has been used
here. So we're gonna learn how to use
both in our apps anyway. And we'll also
see how to use this floating action
button, this is the circular button at
the bottom right of the screen. And that
should be reserved for the primary
function that users would perform from
for any from any particular screen. And
here it allows a new email to be entered.
Now I can scroll through the list of
emails. I'll just go back now, and as I do
that, the RecyclerView is taking care of
things for us - or the ListView, for
that matter, because again we're not sure
which one's being used here. Now I can
also tap on an email to read it, and
we're gonna learn how to respond to taps
and long taps, in our apps. We can also
add buttons to the list, like the star
next to each of these emails under here,
and that marks them as a favorite. Now by
the time you finish this course, you'll
have learnt how to create all these
effects, and a lot more, which is pretty
cool. Android devices can also
determine their location, and they do
this in two ways. The most accurate is by
using the built in GPS module. If the
device has one, then that allows a phone
to be used as a GPS device. An app such
as Copilot is as a good as dedicated GPS
devices, for giving directions or
driving. And Google Maps also has
the advantage of being free, and also
makes a pretty good pretty good GPS
navigator - though not all the emulators
have things like Google Maps installed.
And that's why I chose the API 26
emulator. At the time I'm recording this,
YouTube isn't installed on the API 25
emulators. Now the other way that Android
devices can check their location is
using the Wi-Fi or mobile phone location.
But this is far less accurate. Wi-Fi, in
particular, can be way out because it
only reliably knows the location of your
connection to the Internet.
The phone cabinet in the street, in
other words, which could be a mile or
more from your real location. Alright, so
go back to the home screen now, and
let's just launch Maps by clicking
it over here. Now the first time you
launch it, whether on an emulator or a
real device, you have to accept the terms
of conditions. But I've done that already,
and again that's pretty standard for a
lot of google apps. Alright the
emulators got a default location. We can
change that from the extended controls
menu that we just used to make a phone
call.
So come over here and click on location,
and I can tell the emulator that it's in
Adelaide.
Now the longitude let's type that in
first. That's choosing the longitude and
latitude for Adelaide. Longitude is going
to be one thirty eight thirty eight
point six oh one, and the latitude we
need to set that to minus thirty four
point nine two eight five. Tap on send,
that sends the new location to the
device. And it's important to make the
latitude negative. Adelaide's south of the
Equator, and if we leave it positive we'll
end up in the sea.
And as you can see when I did that, it
automatically went to Adelaide, when I
actually updated the latitude and
longitude. Now you can also simulate the
device moving, either by typing in and
sending new coordinates, or by loading a
set of coordinates stored in a GPX
file. So I'm going to load a file using
the load a GPX XML button, down here. I'm
going to select the file I've already
got here, adelaide.gpx, and open.
So once I've done that, I can come over here
and click on the play button, and when I
do that, the coordinates are sent to
the device just as if we were coming
from a real GPS module. You can see the
Google updates, er, Google Maps is updating
as we do that.
And as you can see, it also tracks time
as well as location, so the speed varies;
just like it would if you got out of a
car and started walking. All right, so
that's the GPS demonstration. And
basically that's a quick demonstration
of how Android apps work, and interact
with the Android operating system.
Now in the next sections, let's start
off with a simple app to get the hang of
using Android Studio to develop apps. And
then we're going to build up to create more
complex apps, involving databases, Google
Maps, REST services and more. And there's
also a tutorial section coming up, and if
you already know Java or Kotlin
(depending on which course you're
watching this video in) then feel free to
skip those videos. But if you're new to
the language, the tutorials will actually
give you the basics. And you'll find the
tutorials in section 4. Alright, so in the
next video we're going to download and
install Android Studio, which is the tool
you'll need to start creating your
Android apps. So we'll see you in that
next video.