Archive for the ‘android’ Category

Don’t overestimate your user’s powers of observation.

Monday, November 17th, 2008

Here’s an interesting usability metric – of over two thousand installs of the Owner application on Android/G1 – there’s a (very) small percentage of users that either do not understand they have to click “save” to store the information they type into the form, or are overlooking the save button, or expect the information to be saved when they hit the back button (without clicking save).

I’ll have to push out an update to warn the user if they try to navigate off a form after changing some information but not saving.

Android_id looks like it can uniquely identify the device

Monday, November 10th, 2008

I went looking for a way to uniquely identify an android device, and found android.provider.Settings.System.ANDROID_ID.

My immediate questions were, is it tied to the SIM card?  Running code to print it out with and without the SIM card in the G1 result in the same number, so it looks like it is unique to the device as far as I can tell.

You can get it like this:

import android.provider.Settings.System;

String android_id = System.getString(this.getContentResolver(), System.ANDROID_ID);

Google reader on Android G1

Sunday, November 9th, 2008

On another mobile os, when I would go to the google reader, it used the mobile version – which is much lighter and faster than the default web with javascript version you get when you navigate to google reader on the android.

I suggest using the mobile url for google reader on your android: http://www.google.com/reader/m/view/

G1 User-agent

Sunday, November 9th, 2008

For RC30: The g1′s user-agent is:
Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2

Update 05.31.09: Cupcake is listed as:
Mozilla/5.0 (Linux; U; Android 1.5; en-us; T-Mobile G1 Build/CRB43) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1

Android Owner application in the market

Friday, November 7th, 2008

Windows mobile has an “Owner Information” section you can enable on the today screen.  This is useful if you leave your device behind somewhere and someone else picks it up.  Strangely, the T-Mobile Android G1 phone does not have something like this.

I created an application named “Owner”, which you can download from the android market as “Factory-H Owner”, which somewhat fills in the missing functionality.  Many users are quick to point out that you have to get past the ‘lock screen’ to run the Owner application.  Unfortunately the api for modifying the lock screen is not released yet, but once it is, the Owner application will be updated to accomodate this functionality.

One thing to remember, Android is not just the G1 phone – it will run on many devices in the future.  One place the “owner information” is very useful is on wireless scanners (which are not phones), so entering the owner information is nice if you have a scanner assigned to someone, and they leave it somewhere.

A possible feature for the Owner application is to have it sync the System.Settings.ANDROID_ID with a service on the internet.  If I did this, you could potentially login to the service, and mark your device as ‘stolen’, then the app could check with the service and possibly phone home with it’s GPS location.  Would users be interested in this functionality?

Debugging Android with emacs

Thursday, November 6th, 2008

When I last did serious java development, the eclipse ide hadn’t come on the scene. VisualAge was so buggy it crashed all the time, so I gave up on java ide’s altogether and got emacs with etags to the point that it didn’t matter. Coming from a C/C++ background, I was used to running gdb in a shell in emacs, so that is what I did with jdb at that time.

Things are different now. Eclipse seems like it might be a good ide, but I’ve never tried it. I like emacs, because I’m quicker in emacs since I know the key combinations, plus having written up lots of lisp over the years to make life easier. Note, there’s something called jde out there for emacs, which makes it into a full fledged ide – but there’s a lot of install work to get it working. I’m not about to bother with that, because I just don’t have the time.

Here’s the purpose of this article – how do you debug android applications using emacs? I did it like this on my macbook:

1. install the android sdk ($SDK)
2. put $SDK/tools on your $PATH
3. Create a new android app in $WORKING like this: activitycreator –out projname com.yourdomain.appname.YourActivity
4. Build the app with ant (you already have ant installed, right?): ant
5. Run the android emulator: emulator &
6. Run the debugging service: ddms &
7. Install your app in the emulator: ant install
8. In your .emacs file, make sure you have gud-jdb-sourcepath and gud-jdb-classpath set to your working directory src and bin/classes folders. This could be a pain if you have to change working directories a lot – but I don’t, and I’m just getting started with java development after being out of it for a long time, so if there is a better way, please let me know what it is.

(custom-set-variables
'(gud-jdb-use-classpath t)
'(gud-jdb-classpath "$WORKING/src:$WORKING/bin/classes")
'(gud-jdb-sourcepath "$WORKING/src")
'(gud-pdb-command-name "~/bin/pdb.py"))

9. Now you can launch your app in the emulator. If you look at the ddms window, you’ll see a line for the process with the column on the right being the port number for the debugger to connect. In this picture it is 8607.

ddms window

10. In emacs, C-x jdb RET and you will see: jdb. Fill in the rest of the line like this, note, no space between sourcepath and the path:
jdb -sourcepath$WORKING/src -attach localhost:8607
11. Set a breakpoint in the source file with C-x SPACE and you’ll hit it when you come around.

Note, you’ll have to fill in the $WORKING yourself, and if you don’t know jdb, I suggest you read the fine manual.

Have fun debugging.