1 00:00:04,069 --> 00:00:05,970 Alright, so we're all ready to start 2 00:00:05,970 --> 00:00:08,250 writing apps for Android, but we should 3 00:00:08,250 --> 00:00:10,110 probably start by answering the question 4 00:00:10,110 --> 00:00:12,450 "What is Android?". Now Android is often 5 00:00:12,450 --> 00:00:14,880 considered to be an operating system, but 6 00:00:14,880 --> 00:00:17,609 it's also a software stack that consists 7 00:00:17,609 --> 00:00:19,770 of an operating system, Linux, and a 8 00:00:19,770 --> 00:00:21,740 framework for developing applications. 9 00:00:21,740 --> 00:00:23,880 And it also includes a number of key 10 00:00:23,880 --> 00:00:26,340 applications, such as contacts, that 11 00:00:26,340 --> 00:00:29,150 reflect its purpose as a mobile platform. 12 00:00:29,150 --> 00:00:31,050 Android was originally written by a 13 00:00:31,050 --> 00:00:32,940 company called Android Incorporated, and 14 00:00:32,940 --> 00:00:36,030 Google bought that company in 2005. Now 15 00:00:36,030 --> 00:00:37,950 it's usual to think of Android as being 16 00:00:37,950 --> 00:00:40,050 developed by Google, and I tend to talk 17 00:00:40,050 --> 00:00:42,090 about Google a lot in this course, but 18 00:00:42,090 --> 00:00:44,399 Android is in fact maintained by 19 00:00:44,399 --> 00:00:47,340 the Open Handset Alliance. So rather than 20 00:00:47,340 --> 00:00:48,989 releasing Android as a proprietary 21 00:00:48,989 --> 00:00:50,610 system when they bought Android 22 00:00:50,610 --> 00:00:52,590 Incorporated, Google got together with a 23 00:00:52,590 --> 00:00:54,719 number of other companies to create the 24 00:00:54,719 --> 00:00:57,840 Open Handset Alliance. The OHA. Now at 25 00:00:57,840 --> 00:00:59,609 the time I'm recording this video, the 26 00:00:59,609 --> 00:01:02,370 OHA has 84 members who are all committed 27 00:01:02,370 --> 00:01:05,519 to keeping Android open source. So you 28 00:01:05,519 --> 00:01:06,780 can actually download the complete 29 00:01:06,780 --> 00:01:08,670 source code for Android, and modify it, if 30 00:01:08,670 --> 00:01:10,350 you wish. There's actually a link to get 31 00:01:10,350 --> 00:01:12,330 the source on the home page of the OHA. 32 00:01:12,330 --> 00:01:14,010 I'm just going to bring that link up on 33 00:01:14,010 --> 00:01:17,460 the screen there; again OHA, Open Handset 34 00:01:17,460 --> 00:01:19,799 Alliance. You can see there's an option 35 00:01:19,799 --> 00:01:21,990 there to get the source code. There's 36 00:01:21,990 --> 00:01:24,409 also a link there to get the SDK as well. 37 00:01:24,409 --> 00:01:26,700 Now the home page is a little bit 38 00:01:26,700 --> 00:01:29,250 misleading, because the most recent entry 39 00:01:29,250 --> 00:01:31,079 in the what's new section, over here, 40 00:01:31,079 --> 00:01:34,170 actually has a date of July 18th 2011. 41 00:01:34,170 --> 00:01:35,850 And that would give the impression that 42 00:01:35,850 --> 00:01:38,220 not much is happening with the OHA, but 43 00:01:38,220 --> 00:01:39,750 that couldn't be further from the truth. 44 00:01:39,750 --> 00:01:41,759 You're taking this course, so you 45 00:01:41,759 --> 00:01:43,770 probably know that version 8 of Android, 46 00:01:43,770 --> 00:01:48,119 code named Oreo, was released in 2017. A new 47 00:01:48,119 --> 00:01:49,439 version of Android is actually released 48 00:01:49,439 --> 00:01:50,280 every year. 49 00:01:50,280 --> 00:01:52,649 Android and the OHA are very much alive. 50 00:01:52,649 --> 00:01:55,259 Now you can learn more about the OHA by 51 00:01:55,259 --> 00:01:57,119 clicking on the Alliance menu item, at 52 00:01:57,119 --> 00:02:01,530 the top of the page. Clicking on 53 00:02:01,530 --> 00:02:06,180 Members, as I've done there, shows the 54 00:02:06,180 --> 00:02:08,250 current members of the OHA; and if you 55 00:02:08,250 --> 00:02:09,598 scroll down, if I scroll down, you can 56 00:02:09,598 --> 00:02:11,580 probably recognize some of the names of 57 00:02:11,580 --> 00:02:13,380 these companies. They're 58 00:02:13,380 --> 00:02:17,550 actually part of the OHA. And there's 59 00:02:17,550 --> 00:02:18,840 different categories here. What we 60 00:02:18,840 --> 00:02:20,340 chose with the default is Mobile 61 00:02:20,340 --> 00:02:24,840 Operators. Handset manufacturers - some 62 00:02:24,840 --> 00:02:27,260 household names here for sure. 63 00:02:27,260 --> 00:02:30,450 SUSE Tech is one, Dell is another, 64 00:02:30,450 --> 00:02:33,240 Jitsu, so some quite well-known companies. 65 00:02:33,240 --> 00:02:36,600 NEC, LG and so on. Now I'm not going to 66 00:02:36,600 --> 00:02:38,220 spend time in this video going through it, 67 00:02:38,220 --> 00:02:42,600 but the Android menu also is well worth 68 00:02:42,600 --> 00:02:44,040 a read, to get an overview of the 69 00:02:44,040 --> 00:02:46,770 thinking behind Android. Now I suggest 70 00:02:46,770 --> 00:02:48,870 that it might be useful for you, if 71 00:02:48,870 --> 00:02:51,330 you're on this page, to actually watch 72 00:02:51,330 --> 00:02:53,040 this video. It's quite a useful video and 73 00:02:53,040 --> 00:02:55,020 have a bit of a read there. All right, 74 00:02:55,020 --> 00:02:56,880 so let's have a quick look at Android, to 75 00:02:56,880 --> 00:02:57,990 see some of the things that we're going 76 00:02:57,990 --> 00:02:59,550 to be looking at getting our apps to do. 77 00:02:59,550 --> 00:03:01,590 Now for this demo we're going to be 78 00:03:01,590 --> 00:03:03,750 using an Android emulator, or virtual 79 00:03:03,750 --> 00:03:05,550 device, and we'll be looking at how to 80 00:03:05,550 --> 00:03:07,680 create virtual devices a bit later in 81 00:03:07,680 --> 00:03:09,810 the course. But think of them as so 82 00:03:09,810 --> 00:03:11,730 basically a way to run our apps on a 83 00:03:11,730 --> 00:03:14,130 wide variety of phones, without having to 84 00:03:14,130 --> 00:03:15,660 buy loads of devices, because it's all 85 00:03:15,660 --> 00:03:18,480 actually done in a virtual machine. 86 00:03:18,480 --> 00:03:19,800 Which means it's running on your 87 00:03:19,800 --> 00:03:22,080 computer. Now in fact, when Google 88 00:03:22,080 --> 00:03:24,660 released Android studio 3, they also 89 00:03:24,660 --> 00:03:26,940 updated the emulators. Now there's also a 90 00:03:26,940 --> 00:03:29,070 couple of emulators that include the 91 00:03:29,070 --> 00:03:30,210 Google Play Store. 92 00:03:30,210 --> 00:03:31,620 and what that means is that you can 93 00:03:31,620 --> 00:03:33,330 install just about any apps from the 94 00:03:33,330 --> 00:03:35,730 Play Store onto your emulator, and we're 95 00:03:35,730 --> 00:03:36,750 going to be discussing that in more 96 00:03:36,750 --> 00:03:38,370 detail when we come to create our own 97 00:03:38,370 --> 00:03:39,900 emulators. But it's something that 98 00:03:39,900 --> 00:03:41,430 developers have been asking for for 99 00:03:41,430 --> 00:03:43,740 quite a few years now. Alright, so I'm going 100 00:03:43,740 --> 00:03:47,130 to switch over now to an emulator - you 101 00:03:47,130 --> 00:03:48,780 can see that I've got it running, but we 102 00:03:48,780 --> 00:03:49,920 can see that it looks like a real 103 00:03:49,920 --> 00:03:52,020 Android phone. There at the bottom are 104 00:03:52,020 --> 00:03:54,570 these three soft keys, and you 105 00:03:54,570 --> 00:03:56,160 find those on just about all Android 106 00:03:56,160 --> 00:03:57,930 devices these days. Though some 107 00:03:57,930 --> 00:03:59,550 manufacturers do replace the middle 108 00:03:59,550 --> 00:04:01,560 button with a physical key, rather than 109 00:04:01,560 --> 00:04:03,690 having it on screen, but the function is 110 00:04:03,690 --> 00:04:05,970 the same. Now the triangular button on 111 00:04:05,970 --> 00:04:07,860 the left over here, that's the back 112 00:04:07,860 --> 00:04:10,050 button, and some devices that appears as 113 00:04:10,050 --> 00:04:11,790 a curved left pointing arrow, and 114 00:04:11,790 --> 00:04:13,830 rather confusingly can appear on the 115 00:04:13,830 --> 00:04:15,510 right-hand side of the screen instead. 116 00:04:15,510 --> 00:04:18,839 The back button, though, is used to go 117 00:04:18,839 --> 00:04:20,370 back to a previous app, dismiss 118 00:04:20,370 --> 00:04:22,860 dialogues, cancel menus; basically it just 119 00:04:22,860 --> 00:04:24,380 goes back to what you were doing before. 120 00:04:24,380 --> 00:04:26,670 And just to see what I mean there, 121 00:04:26,670 --> 00:04:28,260 I can come over here and click on it, to get into our list of 122 00:04:28,260 --> 00:04:32,880 apps. I can choose Gmail, then I can 123 00:04:32,880 --> 00:04:35,220 click on the back button to go back to 124 00:04:35,220 --> 00:04:37,680 the list of apps. Now the middle button 125 00:04:37,680 --> 00:04:40,170 down here, that's the home button, and as 126 00:04:40,170 --> 00:04:41,850 I said some manufacturers use a physical 127 00:04:41,850 --> 00:04:43,980 button for that instead. And this button 128 00:04:43,980 --> 00:04:46,320 takes you back to the home screen. So if 129 00:04:46,320 --> 00:04:50,850 I run Gmail again, and then press the 130 00:04:50,850 --> 00:04:54,120 home button, we end up back on the home 131 00:04:54,120 --> 00:04:55,800 screen, rather than the apps list that we 132 00:04:55,800 --> 00:04:58,050 got when we clicked on back. Now it's got 133 00:04:58,050 --> 00:05:00,570 another function - if you long tap, so 134 00:05:00,570 --> 00:05:02,190 hold it down basically, it'll launch the 135 00:05:02,190 --> 00:05:04,980 Google app: you can see that that's come 136 00:05:04,980 --> 00:05:07,230 up there when I've done that. Now I don't 137 00:05:07,230 --> 00:05:09,120 want to set up the Google assistant at 138 00:05:09,120 --> 00:05:10,260 the moment, so I'm going to click on back 139 00:05:10,260 --> 00:05:12,750 there to get out of that. And we're going 140 00:05:12,750 --> 00:05:13,890 to need another app running for this 141 00:05:13,890 --> 00:05:15,360 next bit, so I'm gonna launch Google Maps 142 00:05:15,360 --> 00:05:17,880 as well. So I'm just going to go to the 143 00:05:17,880 --> 00:05:21,030 home again, click on maps here, and open 144 00:05:21,030 --> 00:05:23,640 up Google Maps as well. Then the square 145 00:05:23,640 --> 00:05:25,800 button on the right, over here, has 146 00:05:25,800 --> 00:05:27,930 various names. You'll find it referred 147 00:05:27,930 --> 00:05:29,700 to as the recents button, or the 148 00:05:29,700 --> 00:05:31,830 multitasking button, or even sometimes 149 00:05:31,830 --> 00:05:34,770 the intents button. Now before I tap it, 150 00:05:34,770 --> 00:05:36,450 one thing that may not be obvious is 151 00:05:36,450 --> 00:05:39,210 that pressing back or home doesn't close 152 00:05:39,210 --> 00:05:41,220 an Android app in the same sense as 153 00:05:41,220 --> 00:05:43,830 closing a program on your PC. The app is 154 00:05:43,830 --> 00:05:45,330 still running, and you can bring it back 155 00:05:45,330 --> 00:05:47,190 to the same state it was when you 156 00:05:47,190 --> 00:05:47,910 dismissed it. 157 00:05:47,910 --> 00:05:50,340 Now the recent button shows all the apps 158 00:05:50,340 --> 00:05:52,380 that are still running, and if I click on 159 00:05:52,380 --> 00:05:55,230 that now, so you can see here that I've 160 00:05:55,230 --> 00:05:59,040 got maps going, as well as Gmail. And you 161 00:05:59,040 --> 00:06:01,200 can actually close it up completely by 162 00:06:01,200 --> 00:06:03,360 clicking on the X up here, at the top 163 00:06:03,360 --> 00:06:05,040 right. But Android will actually take 164 00:06:05,040 --> 00:06:07,050 take care of closing the older apps for 165 00:06:07,050 --> 00:06:09,090 you, if it needs to use the memory for 166 00:06:09,090 --> 00:06:10,320 something else. So there's generally no 167 00:06:10,320 --> 00:06:12,570 need to do that. What I'm doing instead 168 00:06:12,570 --> 00:06:13,860 is tap Google Maps. 169 00:06:13,860 --> 00:06:16,110 When I do that, it brings it to the 170 00:06:16,110 --> 00:06:18,360 foreground. Then you can scroll through 171 00:06:18,360 --> 00:06:20,250 the list of recent apps, so well to 172 00:06:20,250 --> 00:06:21,870 demonstrate that I need a few more apps 173 00:06:21,870 --> 00:06:23,490 running, so we've got a decent list to 174 00:06:23,490 --> 00:06:25,080 scroll through. So I'm going to go back 175 00:06:25,080 --> 00:06:26,910 to the home screen, using the middle 176 00:06:26,910 --> 00:06:30,600 button, and go into apps, and we'll start 177 00:06:30,600 --> 00:06:35,910 by launching calendar. Now back will take 178 00:06:35,910 --> 00:06:37,620 me back to the list of apps, and this 179 00:06:37,620 --> 00:06:41,060 time we're going to select photos. 180 00:06:41,060 --> 00:06:43,020 That's a bit boring because I haven't 181 00:06:43,020 --> 00:06:44,910 got any photos on this emulator. So I'm 182 00:06:44,910 --> 00:06:47,550 gonna go back one more time now, this 183 00:06:47,550 --> 00:06:51,710 time we're gonna start the YouTube app. 184 00:06:51,710 --> 00:06:53,880 Okay, so we've now got a few apps running, 185 00:06:53,880 --> 00:06:55,980 and I can view them all by tapping that 186 00:06:55,980 --> 00:06:58,950 - recents button again. They're all the 187 00:06:58,950 --> 00:07:01,020 apps I've just launched - stacked up with 188 00:07:01,020 --> 00:07:02,820 the most recent on the top of the pile. 189 00:07:02,820 --> 00:07:04,560 You can see on the bottom that's 190 00:07:04,560 --> 00:07:06,810 YouTube. Now this is much easier to do on 191 00:07:06,810 --> 00:07:09,270 a physical device. Using an emulator will 192 00:07:09,270 --> 00:07:10,770 take a little bit of getting used to, 193 00:07:10,770 --> 00:07:12,210 because the mouse pointer doesn't quite 194 00:07:12,210 --> 00:07:14,160 behave the same as a finger on a 195 00:07:14,160 --> 00:07:16,050 touchscreen. And hopefully I won't 196 00:07:16,050 --> 00:07:17,550 accidentally touch an app while trying 197 00:07:17,550 --> 00:07:19,170 to scroll through them. But the way to 198 00:07:19,170 --> 00:07:20,430 scroll through them is to to hold the 199 00:07:20,430 --> 00:07:22,440 mouse button down while moving the mouse, 200 00:07:22,440 --> 00:07:25,080 to simulate a finger dragging. So if I do 201 00:07:25,080 --> 00:07:28,770 that, you can see here that I can 202 00:07:28,770 --> 00:07:31,260 actually move down and change the list 203 00:07:31,260 --> 00:07:34,410 of apps, as I scroll down, or scroll up 204 00:07:34,410 --> 00:07:39,030 for that matter. I'm getting the 205 00:07:39,030 --> 00:07:41,850 different apps as I do that. 206 00:07:41,850 --> 00:07:43,230 Basically it's simulating the finger 207 00:07:43,230 --> 00:07:45,450 dragging of the phone's touchscreen. Now 208 00:07:45,450 --> 00:07:46,830 you saw that when I was dragging, the 209 00:07:46,830 --> 00:07:48,360 recent apps move off the bottom of 210 00:07:48,360 --> 00:07:52,410 the screen, to reveal the older ones. 211 00:07:52,410 --> 00:07:54,420 Like so. If I start down there, then as I 212 00:07:54,420 --> 00:07:56,370 scroll up you can see Photos is coming 213 00:07:56,370 --> 00:07:59,670 up, YouTube, and so on. Now the Linux 214 00:07:59,670 --> 00:08:02,490 kernel allows multitasking, and Android's 215 00:08:02,490 --> 00:08:05,250 built on top of the Linux kernel. So an 216 00:08:05,250 --> 00:08:07,470 Android phone is a multitasking computer. 217 00:08:07,470 --> 00:08:09,090 And you can have actually have several 218 00:08:09,090 --> 00:08:10,440 apps running at the same time, which 219 00:08:10,440 --> 00:08:11,970 we're doing here, and this can be very 220 00:08:11,970 --> 00:08:13,710 useful if you need to do something like 221 00:08:13,710 --> 00:08:15,150 checking your calendar while talking on 222 00:08:15,150 --> 00:08:17,820 the phone, for example. And in fact we can 223 00:08:17,820 --> 00:08:20,220 simulate that. I'll select Gmail from the 224 00:08:20,220 --> 00:08:23,070 list of apps, so I'll scroll down, click 225 00:08:23,070 --> 00:08:26,010 on Gmail. And next I'm going to phone my 226 00:08:26,010 --> 00:08:28,050 emulator. Now at the bottom of the side 227 00:08:28,050 --> 00:08:30,720 menu, over here, is this ellipsis - three 228 00:08:30,720 --> 00:08:33,330 dots. If I click on that, that brings up 229 00:08:33,330 --> 00:08:34,890 an extended controls; which I'll just 230 00:08:34,890 --> 00:08:36,330 move over, so you can see the screen as 231 00:08:36,330 --> 00:08:41,309 well. This the menu lets you play around 232 00:08:41,309 --> 00:08:43,350 with things like location and text 233 00:08:43,350 --> 00:08:45,480 messages. Now the phone option in the 234 00:08:45,480 --> 00:08:49,860 left pane, over here, I click on that ... that 235 00:08:49,860 --> 00:08:51,750 allows me to send SMS messages to the 236 00:08:51,750 --> 00:08:53,220 phone and you can also simulate an 237 00:08:53,220 --> 00:08:53,850 incoming 238 00:08:53,850 --> 00:08:56,639 phone call, using the call phone button. 239 00:08:56,639 --> 00:08:58,199 And you can even enter different phone 240 00:08:58,199 --> 00:08:59,970 numbers, to build up a phone log, which 241 00:08:59,970 --> 00:09:01,500 can be useful if you're testing an app 242 00:09:01,500 --> 00:09:03,660 that works with the phone log. Now on 243 00:09:03,660 --> 00:09:05,880 this Nexus emulator, that causes a 244 00:09:05,880 --> 00:09:07,319 message to drop down so that I can 245 00:09:07,319 --> 00:09:08,670 answer the call. Let's just do that. 246 00:09:08,670 --> 00:09:12,180 call device, you can see that's popped up 247 00:09:12,180 --> 00:09:14,100 there. I've come over here now onto the 248 00:09:14,100 --> 00:09:18,340 device. I click on answer. 249 00:09:18,340 --> 00:09:20,230 Now you can't really have a phone 250 00:09:20,230 --> 00:09:22,270 conversation with the emulator, but the 251 00:09:22,270 --> 00:09:23,920 emulator is now behaving like a real 252 00:09:23,920 --> 00:09:26,170 phone that's in a phone call. So without 253 00:09:26,170 --> 00:09:27,520 hanging up the phone, I could tap on the 254 00:09:27,520 --> 00:09:31,870 recents button go back to my email, and 255 00:09:31,870 --> 00:09:34,240 view that. Now there isn't much in this 256 00:09:34,240 --> 00:09:35,620 email, because I'm using a test account 257 00:09:35,620 --> 00:09:37,810 for this demo, but it can be useful to 258 00:09:37,810 --> 00:09:39,490 check some details in an email during a 259 00:09:39,490 --> 00:09:41,380 phone call. All right, so now that I've 260 00:09:41,380 --> 00:09:43,060 checked my email, I can tap the recents 261 00:09:43,060 --> 00:09:45,400 button again, and go back to the phone 262 00:09:45,400 --> 00:09:47,170 call. And obviously if that was off the 263 00:09:47,170 --> 00:09:49,270 list, we could scroll up and down to find 264 00:09:49,270 --> 00:09:51,910 it. And just click it to actually bring 265 00:09:51,910 --> 00:09:53,770 that back on screen again. So that's 266 00:09:53,770 --> 00:09:55,390 pretty neat. The Android phone that fits 267 00:09:55,390 --> 00:09:57,490 in your pocket is more powerful than most 268 00:09:57,490 --> 00:09:59,140 desktop computers from just twenty years 269 00:09:59,140 --> 00:10:01,300 ago. Now there is a slight oddity 270 00:10:01,300 --> 00:10:03,130 sometimes with simulating phone calls on 271 00:10:03,130 --> 00:10:05,320 the emulators. At the moment, when I tap 272 00:10:05,320 --> 00:10:07,060 the red floating action button down here 273 00:10:07,060 --> 00:10:09,880 during the call, the extended control 274 00:10:09,880 --> 00:10:12,700 menu sometimes doesn't seem to update. It 275 00:10:12,700 --> 00:10:13,930 thinks there's still a call in progress. 276 00:10:13,930 --> 00:10:16,210 So tapping the button in there will end 277 00:10:16,210 --> 00:10:17,710 the call, but in this case that has 278 00:10:17,710 --> 00:10:19,750 actually worked okay, but if you get a 279 00:10:19,750 --> 00:10:20,950 problem there, just tap on the button 280 00:10:20,950 --> 00:10:22,540 over here, to end the call. It's not 281 00:10:22,540 --> 00:10:24,280 really a big problem, just something to 282 00:10:24,280 --> 00:10:25,570 be aware of when you're testing how your 283 00:10:25,570 --> 00:10:27,520 apps behave when something like a phone 284 00:10:27,520 --> 00:10:30,070 call happens. Now the phone app, by the 285 00:10:30,070 --> 00:10:32,410 way, doesn't appear in the recents list 286 00:10:32,410 --> 00:10:34,450 after you end a call. So when I tap the 287 00:10:34,450 --> 00:10:37,839 recent button again, you can see that 288 00:10:37,839 --> 00:10:40,960 it's actually disappeared. There's only 289 00:10:40,960 --> 00:10:42,310 the apps I had running before the 290 00:10:42,310 --> 00:10:44,620 phone call came in. To get back to it, we 291 00:10:44,620 --> 00:10:47,470 need to tap the home button, click on 292 00:10:47,470 --> 00:10:50,350 the blue phone icon here. Now I 293 00:10:50,350 --> 00:10:51,940 haven't got any favourites saved, but the 294 00:10:51,940 --> 00:10:53,770 middle tab, this one here with the clock 295 00:10:53,770 --> 00:10:56,950 icon, shows the time and duration of the 296 00:10:56,950 --> 00:10:58,570 you know quote-unquote call I just 297 00:10:58,570 --> 00:11:00,580 received. And I can even simulate an 298 00:11:00,580 --> 00:11:02,980 outgoing call by tapping the phone icon 299 00:11:02,980 --> 00:11:05,950 on the right over here, and that 300 00:11:05,950 --> 00:11:07,450 simulates, as I said, an outgoing phone 301 00:11:07,450 --> 00:11:08,980 call. Of course we're not really going 302 00:11:08,980 --> 00:11:10,390 to make a phone call, but it's a great 303 00:11:10,390 --> 00:11:12,690 feature, again, when testing your apps. 304 00:11:12,690 --> 00:11:14,589 Alright, so I'm going to hang up the phone, 305 00:11:14,589 --> 00:11:17,440 let's hang up that call now. 306 00:11:17,440 --> 00:11:20,050 Let's have a look at split screen mode. Now a 307 00:11:20,050 --> 00:11:21,339 new feature that was introduced in 308 00:11:21,339 --> 00:11:23,680 Android 7 Nougat is split screen mode. 309 00:11:23,680 --> 00:11:25,660 As I said, don't worry if you haven't 310 00:11:25,660 --> 00:11:28,270 got an Android 7 or later device. All the 311 00:11:28,270 --> 00:11:29,920 apps we're developing this course will 312 00:11:29,920 --> 00:11:31,779 run on all devices, on Android 4 313 00:11:31,779 --> 00:11:34,629 - that's Android Jellybean - onwards. They 314 00:11:34,629 --> 00:11:36,040 won't be able to use split screen mode 315 00:11:36,040 --> 00:11:38,290 on earlier devices, but it's still useful 316 00:11:38,290 --> 00:11:40,540 to see what it is. Now some 317 00:11:40,540 --> 00:11:42,879 Samsung devices have had split screen 318 00:11:42,879 --> 00:11:44,949 for a while, but it's now part of Android 319 00:11:44,949 --> 00:11:47,199 itself, which means that all devices from 320 00:11:47,199 --> 00:11:49,660 Nougat onwards will be able to use it. 321 00:11:49,660 --> 00:11:51,309 Now you need one app already running, to 322 00:11:51,309 --> 00:11:53,139 go into split screen mode, and I've 323 00:11:53,139 --> 00:11:54,430 already got the phone dialer on the screen. 324 00:11:54,430 --> 00:11:57,579 So we'll use that for this demo. Now with 325 00:11:57,579 --> 00:11:59,050 that running, which it is, I'm gonna long 326 00:11:59,050 --> 00:12:02,350 tap over here, on the recents button, and 327 00:12:02,350 --> 00:12:03,399 again, on a phone, you'd be holding 328 00:12:03,399 --> 00:12:04,870 your finger on it. In the emulator I 329 00:12:04,870 --> 00:12:06,189 just held the mouse button down, until 330 00:12:06,189 --> 00:12:08,139 that happened. Now on phones that've 331 00:12:08,139 --> 00:12:09,819 got soft buttons, rather than physical 332 00:12:09,819 --> 00:12:12,160 devices, the icon changes to show you 333 00:12:12,160 --> 00:12:14,019 that you're in split screen. So instead 334 00:12:14,019 --> 00:12:17,259 of just a square, it shows two boxes 335 00:12:17,259 --> 00:12:18,790 inside the square, to represent the two 336 00:12:18,790 --> 00:12:20,170 apps running. And that's what you can see 337 00:12:20,170 --> 00:12:22,420 down here. Now I can scroll through the 338 00:12:22,420 --> 00:12:24,670 list of apps down the bottom now, and tap 339 00:12:24,670 --> 00:12:25,899 the one that I want to open in that 340 00:12:25,899 --> 00:12:29,769 other half of the screen. Again I can just 341 00:12:29,769 --> 00:12:31,959 come down and select them. like so. Now 342 00:12:31,959 --> 00:12:33,910 some apps can't support running in split 343 00:12:33,910 --> 00:12:35,980 screen, so you may see a message over 344 00:12:35,980 --> 00:12:38,199 those apps informing you of that. But I 345 00:12:38,199 --> 00:12:40,689 can scroll down and select, for example 346 00:12:40,689 --> 00:12:43,120 the Gmail. Click on that, and I can have 347 00:12:43,120 --> 00:12:45,069 that and the dialer running together on 348 00:12:45,069 --> 00:12:47,680 the device, on screen at the same time. So 349 00:12:47,680 --> 00:12:49,779 yeah that's pretty neat. And it's also 350 00:12:49,779 --> 00:12:51,579 possible to copy and paste between the 351 00:12:51,579 --> 00:12:53,259 two apps, but not all apps actually 352 00:12:53,259 --> 00:12:55,600 support that. Now the bar in the middle 353 00:12:55,600 --> 00:12:58,209 here looks like it lets you resize the 354 00:12:58,209 --> 00:12:59,889 apps, but at the moment anyway it's just 355 00:12:59,889 --> 00:13:01,209 used to close one or the other, by 356 00:13:01,209 --> 00:13:02,589 dragging it over the app you want to 357 00:13:02,589 --> 00:13:04,269 remove from the screen. So I'm going to 358 00:13:04,269 --> 00:13:06,430 drag it to get rid of the dialer, so 359 00:13:06,430 --> 00:13:09,610 we're left with just Gmail. So we're back 360 00:13:09,610 --> 00:13:12,250 in single view mode. So we've now got the 361 00:13:12,250 --> 00:13:14,589 one app running, and the recents button has 362 00:13:14,589 --> 00:13:16,179 now changed back to the single square 363 00:13:16,179 --> 00:13:18,370 again. Okay so let's have a look at some 364 00:13:18,370 --> 00:13:19,269 of the things we're going to be learning 365 00:13:19,269 --> 00:13:22,389 how to add to our apps. Now at the top 366 00:13:22,389 --> 00:13:24,879 of the Gmail app is a toolbar, with a 367 00:13:24,879 --> 00:13:26,589 settings menu on the left, and a search 368 00:13:26,589 --> 00:13:27,819 button on the right. So there's the 369 00:13:27,819 --> 00:13:33,370 settings and there's the search. The 370 00:13:33,370 --> 00:13:35,319 settings menu, as I click it, produces 371 00:13:35,319 --> 00:13:38,050 a navigation drawer. And in this course 372 00:13:38,050 --> 00:13:40,209 we'll see how to create these, as well as 373 00:13:40,209 --> 00:13:42,429 implementing search in our apps. Now to 374 00:13:42,429 --> 00:13:44,230 dismiss the navigation drawer, swipe 375 00:13:44,230 --> 00:13:45,220 to the left. 376 00:13:45,220 --> 00:13:47,410 Now some older phones have a physical 377 00:13:47,410 --> 00:13:49,150 Settings button, instead of the settings 378 00:13:49,150 --> 00:13:51,280 3 bar icon appearing on the toolbar. 379 00:13:51,280 --> 00:13:54,010 It works in the same way, just be aware 380 00:13:54,010 --> 00:13:55,210 of that, if you create an app and the 381 00:13:55,210 --> 00:13:57,280 settings icon doesn't appear on the 382 00:13:57,280 --> 00:13:59,290 toolbar. Now it's also possible to have a 383 00:13:59,290 --> 00:14:01,720 more traditional menu on the toolbar, and 384 00:14:01,720 --> 00:14:03,130 we'll be learning how to create menus 385 00:14:03,130 --> 00:14:04,690 before we get into navigation drawers. 386 00:14:04,690 --> 00:14:07,060 Now the brief instructions at the top of 387 00:14:07,060 --> 00:14:08,770 the list of emails looks like a snack 388 00:14:08,770 --> 00:14:11,890 bar - this one here. These were introduced 389 00:14:11,890 --> 00:14:13,720 with Lollipop and material design, but 390 00:14:13,720 --> 00:14:15,490 are available now for all Android 391 00:14:15,490 --> 00:14:17,440 versions - dating right back to version 392 00:14:17,440 --> 00:14:19,840 2.1 And they're similar to the toast 393 00:14:19,840 --> 00:14:21,460 messages that pop up briefly on the 394 00:14:21,460 --> 00:14:23,530 screen, but you can also add actions to 395 00:14:23,530 --> 00:14:24,520 them, which makes them more interactive 396 00:14:24,520 --> 00:14:27,460 than the old toast messages. This one has 397 00:14:27,460 --> 00:14:28,960 just a simple button to close the snack 398 00:14:28,960 --> 00:14:30,850 bar, but you can also swipe them off the 399 00:14:30,850 --> 00:14:34,510 screen, like so. Now, the emails appear in 400 00:14:34,510 --> 00:14:36,220 a list, and we can create lists like this 401 00:14:36,220 --> 00:14:38,500 using either the ListView widget or a 402 00:14:38,500 --> 00:14:41,080 more recent replacement, called a RecyclerView. 403 00:14:41,080 --> 00:14:43,270 Now, the RecyclerView is more 404 00:14:43,270 --> 00:14:45,760 flexible, but you can't tell by looking 405 00:14:45,760 --> 00:14:46,990 at the screen which one has been used 406 00:14:46,990 --> 00:14:48,340 here. So we're gonna learn how to use 407 00:14:48,340 --> 00:14:50,920 both in our apps anyway. And we'll also 408 00:14:50,920 --> 00:14:52,330 see how to use this floating action 409 00:14:52,330 --> 00:14:54,790 button, this is the circular button at 410 00:14:54,790 --> 00:14:56,440 the bottom right of the screen. And that 411 00:14:56,440 --> 00:14:58,030 should be reserved for the primary 412 00:14:58,030 --> 00:14:59,560 function that users would perform from 413 00:14:59,560 --> 00:15:02,140 for any from any particular screen. And 414 00:15:02,140 --> 00:15:04,470 here it allows a new email to be entered. 415 00:15:04,470 --> 00:15:06,460 Now I can scroll through the list of 416 00:15:06,460 --> 00:15:10,780 emails. I'll just go back now, and as I do 417 00:15:10,780 --> 00:15:13,270 that, the RecyclerView is taking care of 418 00:15:13,270 --> 00:15:15,460 things for us - or the ListView, for 419 00:15:15,460 --> 00:15:16,600 that matter, because again we're not sure 420 00:15:16,600 --> 00:15:18,550 which one's being used here. Now I can 421 00:15:18,550 --> 00:15:22,510 also tap on an email to read it, and 422 00:15:22,510 --> 00:15:24,160 we're gonna learn how to respond to taps 423 00:15:24,160 --> 00:15:27,100 and long taps, in our apps. We can also 424 00:15:27,100 --> 00:15:28,930 add buttons to the list, like the star 425 00:15:28,930 --> 00:15:31,000 next to each of these emails under here, 426 00:15:31,000 --> 00:15:33,670 and that marks them as a favorite. Now by 427 00:15:33,670 --> 00:15:34,990 the time you finish this course, you'll 428 00:15:34,990 --> 00:15:36,190 have learnt how to create all these 429 00:15:36,190 --> 00:15:38,410 effects, and a lot more, which is pretty 430 00:15:38,410 --> 00:15:40,570 cool. Android devices can also 431 00:15:40,570 --> 00:15:42,670 determine their location, and they do 432 00:15:42,670 --> 00:15:45,160 this in two ways. The most accurate is by 433 00:15:45,160 --> 00:15:47,620 using the built in GPS module. If the 434 00:15:47,620 --> 00:15:49,630 device has one, then that allows a phone 435 00:15:49,630 --> 00:15:52,240 to be used as a GPS device. An app such 436 00:15:52,240 --> 00:15:55,060 as Copilot is as a good as dedicated GPS 437 00:15:55,060 --> 00:15:56,860 devices, for giving directions or 438 00:15:56,860 --> 00:15:59,130 driving. And Google Maps also has 439 00:15:59,130 --> 00:16:01,710 the advantage of being free, and also 440 00:16:01,710 --> 00:16:03,780 makes a pretty good pretty good GPS 441 00:16:03,780 --> 00:16:06,000 navigator - though not all the emulators 442 00:16:06,000 --> 00:16:07,650 have things like Google Maps installed. 443 00:16:07,650 --> 00:16:10,290 And that's why I chose the API 26 444 00:16:10,290 --> 00:16:12,360 emulator. At the time I'm recording this, 445 00:16:12,360 --> 00:16:14,460 YouTube isn't installed on the API 25 446 00:16:14,460 --> 00:16:16,740 emulators. Now the other way that Android 447 00:16:16,740 --> 00:16:18,870 devices can check their location is 448 00:16:18,870 --> 00:16:20,970 using the Wi-Fi or mobile phone location. 449 00:16:20,970 --> 00:16:24,000 But this is far less accurate. Wi-Fi, in 450 00:16:24,000 --> 00:16:25,710 particular, can be way out because it 451 00:16:25,710 --> 00:16:28,050 only reliably knows the location of your 452 00:16:28,050 --> 00:16:29,460 connection to the Internet. 453 00:16:29,460 --> 00:16:31,200 The phone cabinet in the street, in 454 00:16:31,200 --> 00:16:32,670 other words, which could be a mile or 455 00:16:32,670 --> 00:16:34,980 more from your real location. Alright, so 456 00:16:34,980 --> 00:16:38,340 go back to the home screen now, and 457 00:16:38,340 --> 00:16:39,690 let's just launch Maps by clicking 458 00:16:39,690 --> 00:16:41,850 it over here. Now the first time you 459 00:16:41,850 --> 00:16:43,650 launch it, whether on an emulator or a 460 00:16:43,650 --> 00:16:45,810 real device, you have to accept the terms 461 00:16:45,810 --> 00:16:47,970 of conditions. But I've done that already, 462 00:16:47,970 --> 00:16:49,470 and again that's pretty standard for a 463 00:16:49,470 --> 00:16:51,980 lot of google apps. Alright the 464 00:16:51,980 --> 00:16:54,960 emulators got a default location. We can 465 00:16:54,960 --> 00:16:56,730 change that from the extended controls 466 00:16:56,730 --> 00:16:58,140 menu that we just used to make a phone 467 00:16:58,140 --> 00:16:58,530 call. 468 00:16:58,530 --> 00:17:00,540 So come over here and click on location, 469 00:17:00,540 --> 00:17:02,640 and I can tell the emulator that it's in 470 00:17:02,640 --> 00:17:03,210 Adelaide. 471 00:17:03,210 --> 00:17:05,130 Now the longitude let's type that in 472 00:17:05,130 --> 00:17:06,569 first. That's choosing the longitude and 473 00:17:06,569 --> 00:17:09,390 latitude for Adelaide. Longitude is going 474 00:17:09,390 --> 00:17:11,730 to be one thirty eight thirty eight 475 00:17:11,730 --> 00:17:15,959 point six oh one, and the latitude we 476 00:17:15,959 --> 00:17:18,030 need to set that to minus thirty four 477 00:17:18,030 --> 00:17:23,750 point nine two eight five. Tap on send, 478 00:17:23,750 --> 00:17:26,760 that sends the new location to the 479 00:17:26,760 --> 00:17:29,430 device. And it's important to make the 480 00:17:29,430 --> 00:17:31,590 latitude negative. Adelaide's south of the 481 00:17:31,590 --> 00:17:33,090 Equator, and if we leave it positive we'll 482 00:17:33,090 --> 00:17:39,200 end up in the sea. 483 00:17:39,200 --> 00:17:41,149 And as you can see when I did that, it 484 00:17:41,149 --> 00:17:43,039 automatically went to Adelaide, when I 485 00:17:43,039 --> 00:17:45,049 actually updated the latitude and 486 00:17:45,049 --> 00:17:47,960 longitude. Now you can also simulate the 487 00:17:47,960 --> 00:17:49,970 device moving, either by typing in and 488 00:17:49,970 --> 00:17:52,369 sending new coordinates, or by loading a 489 00:17:52,369 --> 00:17:54,139 set of coordinates stored in a GPX 490 00:17:54,139 --> 00:17:56,149 file. So I'm going to load a file using 491 00:17:56,149 --> 00:18:01,220 the load a GPX XML button, down here. I'm 492 00:18:01,220 --> 00:18:02,389 going to select the file I've already 493 00:18:02,389 --> 00:18:06,320 got here, adelaide.gpx, and open. 494 00:18:06,320 --> 00:18:07,580 So once I've done that, I can come over here 495 00:18:07,580 --> 00:18:09,590 and click on the play button, and when I 496 00:18:09,590 --> 00:18:11,059 do that, the coordinates are sent to 497 00:18:11,059 --> 00:18:12,409 the device just as if we were coming 498 00:18:12,409 --> 00:18:17,059 from a real GPS module. You can see the 499 00:18:17,059 --> 00:18:19,820 Google updates, er, Google Maps is updating 500 00:18:19,820 --> 00:18:23,530 as we do that. 501 00:18:23,530 --> 00:18:26,530 And as you can see, it also tracks time 502 00:18:26,530 --> 00:18:28,540 as well as location, so the speed varies; 503 00:18:28,540 --> 00:18:30,550 just like it would if you got out of a 504 00:18:30,550 --> 00:18:32,980 car and started walking. All right, so 505 00:18:32,980 --> 00:18:35,820 that's the GPS demonstration. And 506 00:18:35,820 --> 00:18:37,480 basically that's a quick demonstration 507 00:18:37,480 --> 00:18:39,670 of how Android apps work, and interact 508 00:18:39,670 --> 00:18:41,850 with the Android operating system. 509 00:18:41,850 --> 00:18:44,320 Now in the next sections, let's start 510 00:18:44,320 --> 00:18:46,420 off with a simple app to get the hang of 511 00:18:46,420 --> 00:18:49,240 using Android Studio to develop apps. And 512 00:18:49,240 --> 00:18:50,770 then we're going to build up to create more 513 00:18:50,770 --> 00:18:53,620 complex apps, involving databases, Google 514 00:18:53,620 --> 00:18:56,440 Maps, REST services and more. And there's 515 00:18:56,440 --> 00:18:58,870 also a tutorial section coming up, and if 516 00:18:58,870 --> 00:19:00,460 you already know Java or Kotlin 517 00:19:00,460 --> 00:19:01,600 (depending on which course you're 518 00:19:01,600 --> 00:19:03,460 watching this video in) then feel free to 519 00:19:03,460 --> 00:19:05,740 skip those videos. But if you're new to 520 00:19:05,740 --> 00:19:07,990 the language, the tutorials will actually 521 00:19:07,990 --> 00:19:10,090 give you the basics. And you'll find the 522 00:19:10,090 --> 00:19:12,670 tutorials in section 4. Alright, so in the 523 00:19:12,670 --> 00:19:13,900 next video we're going to download and 524 00:19:13,900 --> 00:19:16,990 install Android Studio, which is the tool 525 00:19:16,990 --> 00:19:18,310 you'll need to start creating your 526 00:19:18,310 --> 00:19:20,110 Android apps. So we'll see you in that 527 00:19:20,110 --> 00:19:22,620 next video.