Using the Android Device Monitor6:36 with Ben Deitch
The Android Device Monitor is a powerful tool for controlling our device. In this video we'll see some of the more useful features and go over how to use them.
* With the new Android emulator the emulator control tab is greyed out and inaccessible. It's functionality has been moved to 'Extended controls' pop up which is accessed through the ' . . . ' on the toolbar next to the emulator.
Another important tool in our arsenal is the Android Device Monitor. 0:00 From the Android Device Monitor, we can take screenshots, spoof incoming calls and 0:03 texts, spoof location data and much more. 0:08 And actually, ever since Android Studio 2.0, 0:11 a lot of these functionality can be done right from the emulator. 0:14 But there's still a few good reasons to use the Android Device Monitor. 0:17 To open it click on Tools > Android > Android Device Monitor. 0:20 Once it's open, we can click on our device on the side bar on the left to select it, 0:30 but for now let's leave this behind and jump back to the emulator. 0:34 One of the cool things we can do from here is, send fake phone calls and 0:40 text messages to our virtual device. 0:44 Testing how an app responds to incoming phone calls and 0:46 text messages, is an important part of the testing process. 0:49 You wouldn't want your music player to keep playing during a phone call. 0:52 So if we click over here on the three dots, and then click on phone, 0:57 we can type in an arbitrary number, Like 123456789 and 1:02 then send this text message to our device. 1:10 Look I got a text. 1:16 Cool, and if you wanted to call the device with that number, 1:22 you just click the call device button. 1:25 Hey, now's not really a good time for a phone call. 1:29 Another cool thing we can do from here is set the location of our virtual device 1:33 by specifying a latitude and longitude. 1:38 An easy way to get latitude and longitude information is by using Google Maps. 1:41 Just find a location you're interested in, let's say Tokyo, 1:46 Then right click on the map and select what's here, 1:53 to have Google Maps show you the coordinates. 1:57 Now you can copy and paste in the first coordinate, As the latitude, 2:02 On the location tab, And 2:11 copy and paste in the second coordinate as the longitude. 2:17 Then when you hit send, Android will start to think your device is in Tokyo. 2:30 To check this, all we need to do, is go home and since for our virtual device we 2:37 decided to include the Google APIs, we can just click in here, go to Google Maps, 2:42 And click on the Where am I button. 2:54 And awesome, it thinks we're in Tokyo. 3:03 Another thing you might wanna change while your app is running, 3:07 is the network speed and latency. 3:09 We saw earlier how we can set these as properties of our virtual device. 3:12 But changing them from in here, on the Cellular tab, 3:16 let us modify the network speed and latency in real time. 3:21 Let's test it out. 3:25 I'm going to go to Google Images, 3:27 And look up pictures of alpaca, 3:40 Looks like that loaded pretty quickly. 3:48 Now let's change the speed of our network to EDGE, 3:51 which is a little slower than 3G, and refresh the page. 3:55 Wow, this is taking a lot longer to load. 4:07 Being able to change network settings on the fly is a useful feature for 4:11 making sure an app handles network transitions gracefully. 4:14 And being able to test your app on a really slow network is a great way to see 4:23 what some of your users might be dealing with. 4:26 While this keeps loading, another useful thing we can do right from the emulator, 4:32 is take screenshots. 4:36 This can be useful for gathering screenshots on many different types 4:38 of device to use in a listing on the Google Play Store. 4:41 We can take a screen shot by clicking on the camera icon over here. 4:44 Also, taking a screenshot might take a few seconds. 4:50 That's because it takes the screenshot at the full resolution of your 4:53 virtual device. 4:56 Just like if you were taking a screen shot on an actual device. 4:58 Also, the screenshots should be stored on your computer. 5:01 For me on a Mac, it puts it in the Desktop folder. 5:05 Getting back to the Android Device Monitor, one thing we still can't do 5:12 directly from the emulator is manage the files on our virtual device. 5:17 Let's click on the file explorer tab, to see what we can do. 5:21 On the top right, we have options to pull files from the device to our computer, 5:26 push files from our computer to the device, delete files and add new folders. 5:31 I really like that picture I took in the last video. 5:38 Let's see how I would pull onto my computer. 5:41 Start by expanding the storage folder, and then emulated, and then zero. 5:46 And let me give a little more room to this name column. 5:54 These should be the folders you're familiar with seeing if you've ever used 5:58 a File Explorer on your Android device. 6:02 And to find that picture I took with the camera, 6:03 we just need to go into the DCIM folder and then the camera folder. 6:07 Then I'll highlight my file and 6:11 click to pull it from the device to my computer. 6:15 And that's a fine place to put it. 6:19 And now, it's on my computer. 6:24 Hopefully, you now have a better idea of how to make the most 6:27 of the Android emulator. 6:31 It really is a powerful tool for thoroughly testing your apps. 6:32
You need to sign up for Treehouse in order to download course files.Sign up