Tuesday, December 14, 2010

Simulate an Incoming sms on Android Emulator

You can simulate an incoming sms in an Android Virtual Device Emulator in two ways. 
  1. Command Prompt (Windows)
  2. Eclipse
If you don't have Eclipse configured, then you can try to simulate a sms to the Emulator from the command prompt. I prefer using Eclipse because it is easy to use.

1. Command Prompt
  • Open Command Prompt 
  • Type telnet
  • Then type o localhost 5554
            Here, an Emulator running locally in the port 5554 is connected. If the Emulator is using another port, then change 5554 correspondingly. Otherwise the connection fails.
  • Finally type sms send 123456 Hello
             Here 123456 is the phone number of the sender. It is in the format sms send <sender> <message>

2. Eclipse
  • Go to Debug mode when the Emulator is running ( Debug button is available at the top right corner of the Eclipse Window )
  • Go to Window -> Show View -> Other -> Android -> Emulator Control

Emulator Control
  • Now type the number in the Incoming number field, select SMS radio button and click on Send button to simulate the sms.

Simulate an Incoming Call in Android Emulator

You can simulate an incoming call in an Android Virtual Device Emulator in two ways. 

  1. Command Prompt (Windows)
  2. Eclipse
If you don't have Eclipse configured, then you can try to simulate a call to the Emulator from the command prompt. I prefer using Eclipse because it is easy to use.


1. Command Prompt

  • Open Command Prompt 
  • Type telnet
  • Then type o localhost 5554
            Here, an Emulator running locally in the port 5554 is connected. If the Emulator is using another port, then change 5554 correspondingly. Otherwise the connection fails.

  • Finally type gsm call 123456
             Here 123456 is the phone number to be simulated.


2. Eclipse

  • Go to Debug mode when the Emulator is running ( Debug button is available at the top right corner of the Eclipse Window )
  • Go to Window -> Show View -> Other -> Android -> Emulator Control

Emulator Control

  • Now type the number in the Incoming number field, select Voice radio button and click on Call button to simulate the call.

Saturday, December 11, 2010

How to Add Files to SD card of Android Virtual Device (AVD) Emulator

Copying Files From/To Device Emulator:
         Files can be copied from/to android device emulator in two ways. One is from Eclipse and the other is from the command prompt. I prefer using Eclipse, since it is easy and provides a good UI to copy files. 


1) In Eclipse

  • Go to Debug mode when the Emulator is running ( Debug button is available at the top right corner of the Eclipse Window )
  • Select Window --> Show View --> Other --> Android --> File Explorer


File Explorer View in Eclipse
Pull Push
  • Now Select sdcard and copy required files by pressing Push Button
  • Or Select the required file from SD Card and press Pull Button to save them on local system
2) In Command Prompt
             To copy files using command prompt, follow the guide given by Google
             http://developer.android.com/guide/developing/tools/adb.html#copyfiles

    Friday, December 10, 2010

    Creating Android Virtual Device (AVD) in Eclipse

         Creating an Android Virtual Device is mandatory in order to test the working of your code in the Emulator. AVD specifies the version of Android that you want to test your project with. And you can create as many AVDs you want in order to test your project with different Android Platforms.


          Creating an Android Virtual Device can be done from command prompt or from Eclipse.  I prefer using Eclipse. If you do not have Eclipse, you can download from here. The steps to create an Android Virtual Device for Android 2.1 (Eclair) are as follows.


    Step 1: Make sure that you have Android SDK installed and configured in your Eclipse. 
    Step 2: Now go to Window -> Android SDK and AVD Manager in Eclipse. 



    Step 3: NameEnter a valid name for the Virtual Device (virtual_2.1)
    Step 4: Target - Select the target device (Android 2.1)
    Step 5: SD Card - If you want to create a SD card for the device, enter the size (512 MiB) or you can leave it blank if you don't want a SD card.
    Step 6: Skin - Select the Resolution for the Screen from listbox or enter a custom resolution. 
    Step 7: Hardware - Select the Advanced Options here. Click on New button add support for Accelerometer, Camera, GPS, Trackball, Keyboard etc. By default, these hardware requirements are disabled. 
    Step 8: Click Create AVD button 


                 Now the AVD is created and it will be listed in Android SDK and AVD Manager window. Once created, the configurations cannot be edited. If you want to edit or any additional configuration, you need to delete the existing AVD and create a new one again. Your Comments are appreciated since this is my first post.