Getting Exchange email back on my phone

One day my work email suddenly didn't work on my phone. Despite grumbling under my breath and swearing a lot to myself I managed to fix the problem, it wasn't pretty but thankfully things work better now then before. Basically I got skunked by a patch to Exchange 2010 SP1. It was a Bell Samsung branded Android 2.2 device.
The Quick Breakdown:
- Root the phone
- Get a clean version of Email.apk that works from Android SDK
- Uninstall Email on the phone and install working version
- Be smug in the fact that it now works and you don't have to wait for months for the official fix
My phone
First the background info, my phone is a Samsung Galaxy S i9000m from Bell. I've patched the firmware officially a few times to get to Android 2.2 (it started off with 2.1) The phone was first released in Canada some time in July/August 2010. It has decent specs and at one time it was probably considered the best Android Smartphone available to Canadians (for probably like a week). What chaffs me is that there are about a half dozen variants of the phone and each one is just different enough to make instructions on how to fix stuff misleading, it is even worse then a comic book.
The biggest hitch to this device in my eyes is that there is no stable release of CyanogenMod that is crafted for this particular phone. You can install an RC but after reading up on it, that ends up being a bit chancy. Besides if Samsung and Bell can officially get my to 2.3 on the phone (which rumor states will happen eventually) I'll get the best OS that the phone can handle. Android 2.3 has video support for Google Talk and Skype which would be nice.

Root it up
The first real step is to root your phone. This allows you to gain superuser status on the device so that you can issue commands to the phone that can greatly alter the way it works. Phones ship without this enabled to protect users from themselves. The great thing about the Galaxy S is that this is trivial task. The software is called Super One Click. Follow the instructions on the site and all told a 5 min process. I was a bit spooked that I would brick the phone but nothing bad happened. Always mod with care however.
See that big root button there? Yup, that is the one click you need to do. If it works for you please consider donating to the author
Android SDK
The Android SDK is a full blown emulator that you can install on your desktop. With it you can play with parts of the OS, test programs and generally get a feel of how Android works. You can create an emulated device for all the different versions of Android. (Even the 3.x branch, so if you want to play with the Honeycomb interface but don't have access to one the SDK will scratch that itch). Download the SDK create a virtual device using the 2.2 API and start it up. Try out the email client to make sure if works on the Exchange server in question, once it does jump to the command line:
C:\...\android-sdk-windows\platform-tools\adb pull Email.apk
Of course adjust to get the right directories. Transfer that Email.apk you just extracted from the emulation environment and copy it to the SD card of the phone. That will replace the email program on the phone.
Mmmm, emulated Android
File Expert
At this point I had to install a File Browser on the phone to complete the last few steps. Basically I didn't have the appropriate USB drivers on my computer to do this on the command line. Browse the market and install 'File Expert'.
- Run it and go to 'Settings' -> 'File Explorer Settings' -> and tick 'Root Explorer' (Now when you run it you'll get root options)
- Restart File Expert, hit menu then 'Mount' -> 'Mount as Read Write'. By default your system partition is read only. That is so you don't go and make any changes to the OS, like you are about to do
- Browse to /system/app/ and find Email.apk
- Long press and then pick 'File Operations' -> 'Rename' to Email.apk.bak
- Browse to your SD card and select Email.Apk. Install, and everything works again
- Restart the phone just to make sure

Here is the renamed Email.apk. All the System provided APks will be in /system/app
Android vs. iOS
Now I can't imagine having to do something like this on an iOS device. For the primary reason that Apple will keep stuff updated and the Exchange Active Sync component of iOS Email will always work. However *if* such an instance were to happen on a iOS device I imagine it would be close to impossible to do a similar set of steps... Maybe by Jailbreaking the device and fiddling but I'm not 100% sure. I'm more confident in using Android and sometimes having to do this type of stuff versus having an iOS device that presumably will never need to do this level of tinkering but conversely never allow me to tinker to a real low level as Android does, if that makes sense at all.
References
http://alt236.blogspot.com/2010/11/unable-to-open-connection-to-server.html
