1 00:00:00,550 --> 00:00:03,870 Another important tool in our arsenal is the Android Device Monitor. 2 00:00:03,870 --> 00:00:08,030 From the Android Device Monitor, we can take screenshots, spoof incoming calls and 3 00:00:08,030 --> 00:00:11,540 texts, spoof location data and much more. 4 00:00:11,540 --> 00:00:14,017 And actually, ever since Android Studio 2.0, 5 00:00:14,017 --> 00:00:17,195 a lot of these functionality can be done right from the emulator. 6 00:00:17,195 --> 00:00:20,774 But there's still a few good reasons to use the Android Device Monitor. 7 00:00:20,774 --> 00:00:27,414 To open it click on Tools > Android > Android Device Monitor. 8 00:00:30,155 --> 00:00:34,328 Once it's open, we can click on our device on the side bar on the left to select it, 9 00:00:34,328 --> 00:00:37,735 but for now let's leave this behind and jump back to the emulator. 10 00:00:40,394 --> 00:00:44,031 One of the cool things we can do from here is, send fake phone calls and 11 00:00:44,031 --> 00:00:46,760 text messages to our virtual device. 12 00:00:46,760 --> 00:00:49,190 Testing how an app responds to incoming phone calls and 13 00:00:49,190 --> 00:00:52,820 text messages, is an important part of the testing process. 14 00:00:52,820 --> 00:00:55,291 You wouldn't want your music player to keep playing during a phone call. 15 00:00:57,371 --> 00:01:02,338 So if we click over here on the three dots, and then click on phone, 16 00:01:02,338 --> 00:01:10,816 we can type in an arbitrary number, Like 123456789 and 17 00:01:10,816 --> 00:01:16,301 then send this text message to our device. 18 00:01:16,301 --> 00:01:17,705 Look I got a text. 19 00:01:22,006 --> 00:01:25,096 Cool, and if you wanted to call the device with that number, 20 00:01:25,096 --> 00:01:27,107 you just click the call device button. 21 00:01:29,569 --> 00:01:31,367 Hey, now's not really a good time for a phone call. 22 00:01:33,645 --> 00:01:38,423 Another cool thing we can do from here is set the location of our virtual device 23 00:01:38,423 --> 00:01:41,670 by specifying a latitude and longitude. 24 00:01:41,670 --> 00:01:45,500 An easy way to get latitude and longitude information is by using Google Maps. 25 00:01:46,700 --> 00:01:50,305 Just find a location you're interested in, let's say Tokyo, 26 00:01:53,406 --> 00:01:57,468 Then right click on the map and select what's here, 27 00:01:57,468 --> 00:02:01,080 to have Google Maps show you the coordinates. 28 00:02:02,310 --> 00:02:08,060 Now you can copy and paste in the first coordinate, As the latitude, 29 00:02:11,562 --> 00:02:17,245 On the location tab, And 30 00:02:17,245 --> 00:02:19,921 copy and paste in the second coordinate as the longitude. 31 00:02:30,641 --> 00:02:36,340 Then when you hit send, Android will start to think your device is in Tokyo. 32 00:02:37,600 --> 00:02:42,349 To check this, all we need to do, is go home and since for our virtual device we 33 00:02:42,349 --> 00:02:47,412 decided to include the Google APIs, we can just click in here, go to Google Maps, 34 00:02:54,412 --> 00:02:55,871 And click on the Where am I button. 35 00:03:03,952 --> 00:03:06,000 And awesome, it thinks we're in Tokyo. 36 00:03:07,290 --> 00:03:09,870 Another thing you might wanna change while your app is running, 37 00:03:09,870 --> 00:03:11,610 is the network speed and latency. 38 00:03:12,750 --> 00:03:16,810 We saw earlier how we can set these as properties of our virtual device. 39 00:03:16,810 --> 00:03:21,640 But changing them from in here, on the Cellular tab, 40 00:03:21,640 --> 00:03:25,800 let us modify the network speed and latency in real time. 41 00:03:25,800 --> 00:03:27,370 Let's test it out. 42 00:03:27,370 --> 00:03:28,712 I'm going to go to Google Images, 43 00:03:40,892 --> 00:03:42,412 And look up pictures of alpaca, 44 00:03:48,492 --> 00:03:51,172 Looks like that loaded pretty quickly. 45 00:03:51,172 --> 00:03:55,429 Now let's change the speed of our network to EDGE, 46 00:03:55,429 --> 00:04:00,193 which is a little slower than 3G, and refresh the page. 47 00:04:07,173 --> 00:04:11,093 Wow, this is taking a lot longer to load. 48 00:04:11,093 --> 00:04:14,456 Being able to change network settings on the fly is a useful feature for 49 00:04:14,456 --> 00:04:17,433 making sure an app handles network transitions gracefully. 50 00:04:23,353 --> 00:04:26,859 And being able to test your app on a really slow network is a great way to see 51 00:04:26,859 --> 00:04:29,113 what some of your users might be dealing with. 52 00:04:32,793 --> 00:04:36,977 While this keeps loading, another useful thing we can do right from the emulator, 53 00:04:36,977 --> 00:04:38,750 is take screenshots. 54 00:04:38,750 --> 00:04:41,680 This can be useful for gathering screenshots on many different types 55 00:04:41,680 --> 00:04:44,910 of device to use in a listing on the Google Play Store. 56 00:04:44,910 --> 00:04:47,980 We can take a screen shot by clicking on the camera icon over here. 57 00:04:50,380 --> 00:04:53,630 Also, taking a screenshot might take a few seconds. 58 00:04:53,630 --> 00:04:56,710 That's because it takes the screenshot at the full resolution of your 59 00:04:56,710 --> 00:04:58,030 virtual device. 60 00:04:58,030 --> 00:05:00,460 Just like if you were taking a screen shot on an actual device. 61 00:05:01,650 --> 00:05:03,583 Also, the screenshots should be stored on your computer. 62 00:05:05,623 --> 00:05:09,524 For me on a Mac, it puts it in the Desktop folder. 63 00:05:12,884 --> 00:05:17,287 Getting back to the Android Device Monitor, one thing we still can't do 64 00:05:17,287 --> 00:05:21,563 directly from the emulator is manage the files on our virtual device. 65 00:05:21,563 --> 00:05:24,990 Let's click on the file explorer tab, to see what we can do. 66 00:05:26,710 --> 00:05:31,850 On the top right, we have options to pull files from the device to our computer, 67 00:05:31,850 --> 00:05:37,380 push files from our computer to the device, delete files and add new folders. 68 00:05:38,440 --> 00:05:41,100 I really like that picture I took in the last video. 69 00:05:41,100 --> 00:05:42,994 Let's see how I would pull onto my computer. 70 00:05:46,034 --> 00:05:52,254 Start by expanding the storage folder, and then emulated, and then zero. 71 00:05:54,494 --> 00:05:56,454 And let me give a little more room to this name column. 72 00:05:58,914 --> 00:06:02,229 These should be the folders you're familiar with seeing if you've ever used 73 00:06:02,229 --> 00:06:03,974 a File Explorer on your Android device. 74 00:06:03,974 --> 00:06:07,304 And to find that picture I took with the camera, 75 00:06:07,304 --> 00:06:11,894 we just need to go into the DCIM folder and then the camera folder. 76 00:06:11,894 --> 00:06:15,115 Then I'll highlight my file and 77 00:06:15,115 --> 00:06:19,894 click to pull it from the device to my computer. 78 00:06:19,894 --> 00:06:22,054 And that's a fine place to put it. 79 00:06:24,134 --> 00:06:25,850 And now, it's on my computer. 80 00:06:27,740 --> 00:06:31,130 Hopefully, you now have a better idea of how to make the most 81 00:06:31,130 --> 00:06:32,720 of the Android emulator. 82 00:06:32,720 --> 00:06:35,930 It really is a powerful tool for thoroughly testing your apps.