Wandering Jew
Here, there and everywhere

Tue, 21 Apr 2009

On... Android Top Tip!

Just a little thing

I got a T-Mobile G1 (aka HTC Dream) back in November, the first Android device to hit the market. There's a partially-done full writeup somewhere in my draft folder, but for now, I wanted to get down a little tip I discovered today:

I've been trying to sign up with the new PCCW Wifi 'Single Device Plan', which is a very cheap ($28, around US$3.50 per month) unlimited wifi plan which uses the MAC address of the device for authentication. You have to manually login once, entering the activation code you got by SMS, and from then on it'll recognise your device and log you straight in. Their regular wifi service is virtually unusable on a regular basis with Android, since you have to connect to the service, then login before you can get to the internet, but as soon as you connect the device tries to reconnect to gmail, IM, etc. over wifi and fails. Very annoying... One limitation of the single device plan is that the $28 rate is only applicable to mobile phones, not laptops, and they use server-side user-agent sniffing to make sure you're activating a supported device. Android is, of course, no supported.

No problem, says I, since the webkit rendering engine in Android has support for choosing an Android user-agent, a 'desktop' user-agent, or an iPhone user-agent. I knocked together a simple web browser which pretends to be an iPhone, and went to register. Problem, says I - there's something a little funky about the SSL setup used on the activation form, and I can't get it to work with my toy browser. The built-in browser uses undocumented APIs to handle SSL errors, and while I probably could hack something up to work, I really can't be bothered.

I originally discovered that webkit had optional user-agent strings from the famous Mr. Romain Guy - author of the Android Home application - who mentioned something about a debug mode in the browser. Unfortunately, this debug mode is, while not exactly secret, also not well-known, and I went off on a wild goose chase to make my own browser. Today, while randomly browsing the bug list for the best-known Cupcake-on-G1 build, I see a mention of the debug mode, complete with instructions on how to enable it. In short, what you need to do is load the URL "about:debug" - this won't load a page, but will enable debug mode, which adds a bunch of options to the bottom of the 'Settings' panel, including a User-Agent picker.

As soon as I found it, and tested it on this site, I popped down to the PCCW shop in my building, loaded up the activation page, and bang! working fine. I haven't tested it, but according to original instructions, the setting doesn't persist (across a restart of the Browser, or a reboot, I don't know), but it's very useful to know if you just need to access a page behind a stupid iPhone-only user-agent check.

For the record, the other toggleable options which show up are:

Don't really know what any of them do, but I'm sure there are one or two people out there who might want to play around with it...

[16:49] | [] | #

About
Richard
Hong Kong tourist guide (under construction)
Hong Kong blogs you should read
Hemlock's Diaries
Hongkie Town Redux
Hong Kong expat forum
GeoExpat
Podcasts
This week in tech
Israelisms
Been Seen Done

Archives
  • 11/09
  • 04/09
  • 12/08
  • 10/08
  • 08/08
  • 07/08
  • 06/08
  • 04/08
  • 02/08
  • 01/08
  • 12/07
  • 11/07
  • 10/07
  • 09/07
  • 06/07
  • 04/07
  • 03/07
  • 02/07
  • 01/07
  • 12/06
  • 11/06
  • 10/06
  • 08/06
  • 07/06
  • 06/06
  • 05/06
  • 04/06
  • 03/06
  • 02/06
  • 01/06
  • 12/05
  • 11/05
  • 10/05