Android Application Development: Working with the Emulator



Download 10.21 Kb.
Date30.06.2017
Size10.21 Kb.
#22223



Performance Support


Android Application Development: Working with the Emulator

Transcript


The Android Emulator is designed to simulate a real Android device. In this segment, we’re going to learn how you can simulate receiving phone calls and SMS text messages with the Emulator.
I’ve launched an Android 2.3.3 Emulator that I’ve called “Grover”. Now when you’re working with the Emulator sometimes you want to test your program in terms of some of the natural functions that are already on the phone. So here I’ve all of the applications that are on this particular Emulator. And I’ve written a quick application called “Simulating Phone Functions working with the Emulator”.
So now that application is running and let’s say I wanted to simulate a phone call coming into the phone while my application is running to see how it reacts. I’m going to go here into a view called “DDMS” view. We reach it by tapping this double-arrow on the right-hand side and selecting DDMS. If for some reason DDMS is not available from that menu, you can go into the Window menu, Open Perspective - Other, and you’ll find DDMS listed there.
Now in DDMS View, I’ve got this Emulator control panel on the left hand side. What I’m going to do is I’m going to simulate a call from an incoming number, let’s say 555-212-1212. Now we’re going to simulate a voice call so I’ll leave Voice selected and then I’ll select call.
Now when I open my Emulator, it simulates an incoming call. I can simulate answering the call and even ending the call. And then I can see, once we leave the Call Log, how does my application react. For example, if you’re doing something resource intensive like animation, you might have to program for this type of interruption. Another example is I can send an SMS message – “This is a simulated SMS message”. I’m going to click Send and again, if we look at my Device Emulator there’s the message notification and if we pull down just like we’d in a real device, there’s our actual message.
Now the second way to interact with the Emulator is via the command line. So here in the terminal, I’m going to type Telnet localhost 5554. I got the 5554 from right up here and that’s the port number of our Android device. Now I’m actually in the Android Console, if I click Help, it’ll give me a list of commands that are available. If I type, for example, Help Event, it’ll show me the different types of events that are available that I can send, or Help SMS. So I actually could send an SMS right from here, SMS Send will send a text message if I provide a phone number and a message. So we tried SMS Send 555-212-1212 and then the message Testing from the command line. And now you can see the actual message appearing again in the notification area of the Android Emulator.


Download 10.21 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page