how to test a local web application in droid simulator

Main menu:

Topics

Recent Posts

Blog

January 2010
M T W T F S S
« Dec   Feb »
 123
45678910
11121314151617
18192021222324
25262728293031

Past Posts

Java/Java EE

JDBC

Other

how to test a local web application in droid simulator

January 2nd, 2010 by Jeanne Boyarsky

In August, I blogged about how to use the blackberry simulator because information was so scarce.  I’m happy to say the Android emulator documentation is much better.

My goal

About a month ago, beta testers of  JavaRanch’s JForum implementation told me the iPhone and the Droid had a large blank column on the right side of the screen.  Hence needing an emulator to try to fix it.  (This all happened weeks ago – just didn’t get around to blogging about it.)

Note: I didn’t install the Android Eclipse plugin because I’m not doing BlackBerry development.  If you want the plugin, you can install the toolkit.

Steps to download the simulator

  1. Download the SDK for your platform from the Android download site.
  2. Run “SDK Setup” executable from the download
  3. Choose the required available packages for download.  (I wasn’t sure what I needed so I had downloaded all of them.  You definitely need Android 2.0.) .  This step took a long time to install since it downloaded at 55KB/sec – dialup speeds.  I let it run overnight to completion.  It probably took a few hours.

Steps to initially configure the simulator

  1. See what targets are available
    android-sdk-windows\tools>android list targets
    “Android 2.0″ version 5 should be a choice. This is the Droid.  The target looks like:
  2. id: 1 or “android-5″
    Name: Android 2.0
    Type: Platform
    API level: 5
    Revision: 1
    Skins: HVGA (default), QVGA, WQVGA400, WQVGA432, WVGA800, WVGA854
    etc

  3. Create the AVD (Android Virtual Device)
    android-sdk-windows\tools>android create avd -n Droid -t 1

Launching and running

  1. Launch your local Tomcat (or other app server)
  2. Launch the emulator
    android-sdk-windows\tools>emulator -avd Droid
  3. wait a while – it says “Android…” then “ANDROID” in shiny letters
  4. Ignore error message that says “sorry application messaging is not responding”
  5. Test away.  Note that you must use your computer name rather than localhost.  (On windows this is the %COMPUTERNAME% property.)  Thanks to ASP forum for this tip.

Actually using the simulator

Some impressions of using the simulator:

  • It’s great and intuitive.
  • That’s it!  If you read my BlackBerry post, there were a pile of things to get used to.  The Droid just worked.

The goal

The trick is that the Droid and iPhone need to be told the width of the page or they assume it is larger.  It’s an odd effect, but easy to solve by adding the following tag to the header.

<meta name=”viewport” content=”width = 320″ />

Comments

Pingback from how to test a local web application in droid simulator | Down Home … Android Marketing
Posted: January 2, 2010 at 9:57 pm

[...] the original post here: how to test a local web application in droid simulator | Down Home … By admin | category: android, android sdk | tags: droid, emulator-avd, ignore, must-use, [...]

Comment from Eric – Web Designer
Posted: December 10, 2010 at 4:00 pm

That sure makes things easier. Thanks for the info.

Write a comment