17 August 2011

Turn Your PC into a Tablet



Don't tell your iPhone-owning, iPhone-loving friends, but they're not relevant anymore. No more do you have to put up with them flashing their phone around down the pub proclaiming: "This app is hilarious". No, no it's not, it's a grown man pretending his phone is a pint of beer, or worse, making fart noises by pressing a big red button. Genius, that's exactly why humanity spent a century discovering electricity, semiconductors and million-line operating systems that can run on a 500mW processor. Ranting aside, Google Android has done an impressive job of catching up with Apple, perhaps not so much on the consistency or slickness of the interface, but most definitely in the functionality, flexibility and features that it offers.

Another area that Google excels in, much like Microsoft, is wooing and caring for developers. The Android SDK is freely available to download for both Windows and Linux platforms. This opens up some interesting features for everyday folk, not just developers. One is running Android on your desktop PC in the form of an Android emulator. It's designed so you can test out your newly compiled apps without needing an actual device, but it gives you a chance to play around with a functioning Android phone or tablet running any version of the OS from 1.5 through to 3.0. There are even manufacturer specific builds available, such as the Samsung Galaxy Tab and various Sony Ericsson phones.

Firing up the SDK


We're going to take you through how to install and run your own Android emulator, plus do a little hacking. We'll also 'root' the emulated device so we can hack-in Market support. The SDK is useful beyond this as well, as you can use it to screen grab an Android device (for example your phone).

The Android emulator is a development tool, it's not like the Amiga, Spectrum and console emulators you may have tried over the years. The emulator isn't optimized for speed and it runs on a single thread, so our old 2.8GHz Core 2 Duo felt sluggish. A Core i5/7 model with Turbo Boost is going to help things along here. That aside everything inside Android is available to play with, apart from the Market. It all runs well too, apart from web browsing, which does seem to chug.

The emulator also comes with a number of useful options and additional compiled operating systems to play with. If you follow our hacking guide you'll see how you can set the emulator to start from a command line. This is mostly useful for accessing advanced test features, such as adding GPS locations, adjusting audio and routing fake calls. There are more basic options, such as no-boot-anim that speeds up start times by eliminating the opening animation.

Editing features

The built-in emulator controls tend to be more easily accessible. For instance, when you click Start the ghosted-out Scale display option provides an easy way to control the size of the emulation window without affecting its resolution. Usually five-inches will get an oversized window under control. Alternatively, select the device, click 'Edit' and under the Hardware section you can add and adjust a number of attached emulator features. These include adding a virtual D-Pad, keyboard and controls over partition sizes and memory allocations.

Bless Google, they do try, but in the scrabble to just get the thing out of the door, it feels like the odd useful item gets forgotten. One such item is any sort of built-in way of taking screen grabs and being able to fetch them off of an Android device. Thankfully someone at Google remembered, because part of the SDK debug tool is a built-in capture option and we've outlined just how to go about getting that to work in our last walkthrough.

Grabbing video

As it turns out you can take this feature one step further and use it to grab video footage, of a sorts. There's a damn handy Java tool called Droid@Screen available at blog.ribomation.com/2010/01/droidscreen. This is a standalone Java tool that can hook into the Android SDK ADB tool to stream your Android device's output to your desktop. It was originally devised as an easy way to project an Android screen via a PC.

Download and run the Java tool and the first thing that it'll do is ask you where ADB lives. This will usually be C:\Program Files (x86)\Android\android-sdk\platform-tools, unless you installed the SDK elsewhere or have a 32-bit operating system, in which case knock off the (x86).

If the Android device is connected it should pick ADB tool up and display it for you. If you want to capture video then use camstudio.org to capture what's going on in its window. You are even able to specify an actual region so you can grab exactly the Android screen area to cut out the borders of the window.

PART I : Emulating Android


Run an Android tablet on your desktop PC, in three easy steps :

1. Snag the SDK


The key to getting all of this good stuff up and running is the kind heart of Google that provides the Android SKD freely for download. Head over to developer. android.com/sdk and grab the latest Windows executable, at around 32MB this is only a pre-installer. The rest of the Android SDK is downloaded as optional extras enabling you to install versions from 1.5 through to 3.1. We suggest grabbing it all.

2. Enjoy Some Java


Android as a platform is Java-based, so having the right version of Java is somewhat important. Oracle, now the owners of Java, provide a bewildering array of variants and it's also likely you already have a Java Runtime Environment, or JRE, installed on your system. To use the Android SDK you need a Java Development Kit, or JDK, from bit.ly/bMkbpo we suggest grabbing the JDK + Netbeans.

3. Paranoid Android


Click the top-left Virtual devices entry, this lets you create and manage all of your virtual Android devices. Click the 'New' button to get this bandwagon rolling. Give the device a name, ours is 'marvin', choose a suitable Android Target; 3.1 will do and enter a 512MB SD card size. You can keep the other settings as is, though feel free to pick your own resolution or drop the density from 160 to make icons larger.

PART II : Setting up Shop 

Get More from your emulator, enter into the Market

1. Secret files

Taking the 'marvin' device we created earlier you're going to have to copy some files around, push some files to the emulator and generally bully Android. To start, copy the system.img file from x:\ Program Files (x86)\Android\android-sdk\platforms\android-11\ images to x:\Users\\.android\avd\marvin.avd replacing the ‘x’ and with your own.



2. Follow the path

To make life easier add the following paths to the Windows PATH variable, do that by right-clicking on My Computer > Properties > Advanced system settings > Environment Variables... select 'Path' from the System Variables box and click 'Edit'. Add the two paths below separated with a ';"x:\Program Files (x86)\Android\android-sdk\ platform-tools' and 'x:\Program Files (x86)\Android\android-sdk\tools'.

3. Grab the APK

Two application files called GoogleServicesFramework.apk from bitly/inxlei and Vending.apk from bit.ly/i9UcYL need to be pushed to the emulator device. Download, extract and place them on your Desktop. This all has to be done from a command line so select Start, type 'CMD' and Press [Return] to open a command prompt and type 'CD desktop' to change directory to where those apk files are.

4. It's a shell start

Fire up the emulator as a background process with a 200MB partition by typing the following: 'Start /B emulator -avd marvin -partition-size 200'. Type 'adb shell' to open a virtual shell for the device. This lets you communicate with the emulator's system kernel. Make the system partition read/write and root the device with: 'mount -o remount,rw -t yaffs2/dev/block/mtdblock0 /system'

5. Push it real good

We've assumed in the last step that the system partition is mtdblock0. If it's not you'll need to type 'mount' and make a note of the system partition and adjust accordingly. Finally type 'rm /system/ app/SdkSetup.apk' and exit. Back at the command prompt type these two lines: 'adb push GoogleServicesFramework.apk /system/app' and 'adb push Vending.apk /system/app' and the Market icon will appear.

6. Beat the system

It's likely it won't log in, if this is the case in the emulator select Settings > Applications > Manage Applications > All. You need to find the GoogleServicesFramework task and select 'Clear all data' and 'Force Close' then do the same for the Market task. Restart the emulator from the shell. This step is a little hit and miss, it's important not to start the main SDK Manager and leave 'Snapshot' unselected.



2 comments:

Awesome post ! Covered all the points :)

I have installed the stuff you said, but i'm not too tech savvy and could use some help with setting up the rest of the technical bits and pieces.

Post a Comment

Drop in Your Comments, Problems, Suggestions, Praise, Complains or just anything.

We are always excited to hear from you.

Don't post rude or nasty comments. Ethnic slurs, personal insults and abuses are rather uncool. Criticize, but know where to draw the line.

 
Related Posts Plugin for WordPress, Blogger...