Android - Emulator Tutorial

<blockquote > <p >The Android SDK includes a virtual mobile device emulator that runs on your computer. The emulator lets you prototype, develop and test Android applications without using a physical device.</p> </blockquote> <p >In this chapter we are going to explore different functionalities in the emulator that are present in the real android device.</p> <h2 >Creating AVD</h2> <p >If you want to emulate a real device, first crate an AVD with the same device configurations as real device, then launch this AVD from AVD manager.</p> <h2 >Creating Snapshots in Eclipse</h2> <p >Creating snapshots mean saving an emulator state to a file that enables the emulator to be started quickly the next time you try to launch it. The one of the biggest advantage of creating snapshots is that it saves the boot up time.</p> <p >In order to create snapshot, check mark the option of snapshot while creating your AVD. It is shown below &minus;</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <p >The first time you launch the emulator , it will take the usual time of loading. But when you close it and start it again, you will see a considerable amount of time reduction in appearing of emulator.</p> <h2 >Changing Orientation</h2> <p >Usually by default when you launch the emulator, its orientation is vertical, but you can change it orientation by pressing Ctrl+F11 key from keyboard.</p> <p >First launch the emulator. It is shown in the picture below &minus;</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <p >Once it is launched, press<b >Ctrl+F11</b>key to change its orientation. It is shown below:</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <h2 >Emulator Commands.</h2> <p >Apart from just orientation commands, there are other very useful commands of emulator that you should keep in mind while using emulator. They are listed below &minus;</p> <table class="table table-bordered" > <tbody > <tr > <th >Sr.No</th> <th >Command &amp; description</th> </tr> <tr > <td >1</td> <td ><b >Home</b> <p >Shifts to main screen</p> </td> </tr> <tr > <td >2</td> <td ><b >F2</b> <p >Toggles context sensitive menu</p> </td> </tr> <tr > <td >3</td> <td ><b >F3</b> <p >Bring out call log</p> </td> </tr> <tr > <td >4</td> <td ><b >F4</b> <p >End call</p> </td> </tr> <tr > <td >5</td> <td ><b >F5</b> <p >Search</p> </td> </tr> <tr > <td >6</td> <td ><b >F6</b> <p >Toggle trackball mode</p> </td> </tr> <tr > <td >7</td> <td ><b >F7</b> <p >Power button</p> </td> </tr> <tr > <td >8</td> <td ><b >F8</b> <p >Toggle data network</p> </td> </tr> <tr > <td >9</td> <td ><b >Ctrl+F5</b> <p >Ring Volume up</p> </td> </tr> <tr > <td >10</td> <td ><b >Ctrl+F6</b> <p >Ring Volume down</p> </td> </tr> </tbody> </table> <h2 >Emulator - Sending SMS</h2> <p >You can emulate sending SMS to your emulator. There are two ways to do that. You can do that from DDMS which can be found in Android studio, or from Telnet.(Network utility found in windows).</p> <h3 >Sending SMS through Telnet.</h3> <p><img alt="Android Emulator Tutorial" src="" /></p> <p >Telnet is not enabled by default in windows. You have to enable it to use it. Once enabled you can go to command prompt and start telnet by typing telnet.</p> <p >In order to send SMS , note down the AVD number which can be found on the title bar of the emulator. It could be like this 5554 e.t.c. Once noted , type this command in command prompt.</p> <pre class="result notranslate" > telnet localhost 5554 </pre> <p >Press enter when you type the command. It is shown below in the figure.</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <p >You will see that you are now connected to your emulator. Now type this command to send message.</p> <pre class="result notranslate" > sms send 1234 &quot;hello&quot; </pre> <p >Once you type this command , hit enter. Now look at the AVD. You will receive a notification displaying that you got a new text message. It is shown below &minus;</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <h2 >Emulator - Making Call</h2> <p >You can easily make phone calls to your emulator using telent client. You need to connect to your emulator from telnet. It is discussed in the sending sms topic above.</p> <p >After that you will type this command in the telent window to make a call. Its syntax is given below &minus;</p> <pre class="result notranslate" > gsm call 1234 </pre> <p >Once you type this command , hit enter. Now look at the AVD. You will receive a call from the number your put in the command. It is shown below &minus;</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <h2 >Emulator - Transferring files</h2> <p >You can easily transfer files into the emulator and vice versa. In order to do that, you need to select the DDMS utility in Android studio. After that select the file explorer tab. It is shown below &minus;</p> <p><img alt="Android Emulator Tutorial" src="" /></p> <p >Browse through the explorer and make new folder , view existing contents e.t.c.</p>
RangeMem:211.56 KB
返回顶部 留言