Thursday, January 20, 2011

Android: Automating Emulator Actions

When testing Android apps in the Android Emulator you often have to trigger multiple events by hand that a real phone would do on its own for a given "real" event, like plugging in a power cable.

Simulating a power cable being connected to the emulator requires two separate events,
power status charging

and
power ac on

To interact with the android emulator you telnet into it to get an interactive shell - which enables you to send all sorts of commands to it.  Typing in commands like the above over and over to simulate a power cable being connected is annoying at best.

On OSX I have written the following python scripts to enable the condition(s) I want with a single command.

#!/usr/bin/python
import telnetlib
tn = telnetlib.Telnet("localhost",5554)
tn.write("power status charging\r\n")
tn.write("power ac on\r\n")


Save that guy as "power_on.py" in your android-sdk/platform-tools directory - and any time you want to simulate the power cable being connected simply type:
power_on.py

... and for an added bonus here is my power_off script:

#!/usr/bin/python
import telnetlib
tn = telnetlib.Telnet("localhost",5554)
tn.write("power status discharging\r\n")
tn.write("power ac off\r\n")

Wednesday, January 12, 2011

Fun with the SwiftKey Trial for Android

SwiftKey is a 3rd party keyboard for Android that features "AI driven auto complete".

Strangely, it seems to offer suggestions for your "next" word when typing, even if you haven't typed anything at all - so I decided to keep accepting the automatically predicated words until it stopped suggesting them.

Here is what it ultimately typed out for me:
Minimize the last few years ago, I am a beautiful person, but I think I put 79,,,,

Nice!

Saturday, January 08, 2011

Eclipse 3.6 Helios and SVN

Upgraded from Eclipse 3.5 to 3.6 today (blazing fast in OSX finally) and found that my SVN plugin didnt work.

Follow the instructions here to fix: http://www.dingobytes.com/tutorial/subversion-install-for-eclipse-helios-3-6

Android: Introducing BatteryUptime Pro

Pro version of the popular Battery Uptime widget!

Keeps track of the time your Android phone is unplugged.  Records your best run time.  (Same as Settings->About Phone->Battery), and charts your battery uptime over the course of the last 30 days.

Pro version of widget also features the ability to refresh more often than every 30 minutes!

Pro version of widget also features a quick way to navigate to the Android System Battery Stats straight from your homescreen!

After installing the widget, connect your phone to AC power and then remove from AC power to start tracking battery uptime.

lightning-iconPro version of the popular Battery Uptime widget!

Keeps track of the time your Android phone is unplugged.  Records your best run time.  (Same as Settings->About Phone->Battery), and charts your battery uptime over the course of the last 30 days.

Pro version of widget also features the ability to refresh more often than every 30 minutes!

Pro version of widget also features a quick way to navigate to the Android System Battery Stats straight from your homescreen!

After installing the widget, connect your phone to AC power and then remove from AC power to start tracking battery uptime.

Available in the Android Marketplace for $0.99

qrcodescreenshot_config
screenshot_chart