android

Getting Root on Huawei U8665 Fusion 2 Phone

I've had an old Samsung Galaxy S Captivate phone, running Android 2.2, that I've used as a test device while developing Android apps. In my new job, I no longer need to support Android 2.2 (hooray!), but I do need to support Android 2.3 (boo!). I tried installing CyanogenMod to update the Captivate to Android 2.3, but I ended up bricking the device.

Rather than spend more time trying to figure out how to fix that, I looked around for a cheap new Android 2.3 device, and found the Huawei U8865, also known as the "Fusion 2", for $60. That seemed like a reasonable price for a brand-new old phone, so I purchased it and it arrived the next day.

Unfortunately, when I tried using it for development, I hit a snag. My work requires using adb shell and related utilities, and whenever I tried those, I just got a "permission denied" response. I couldn't even take a screenshot.

I looked around for instructions to "root" the phone (that is, get privileged access). They aren't hard to find, but the people who write up these instructions all assume that (a) their readers have no idea what they are doing, and (b) everybody uses Windows. Neither of those are true for me, so I had to translate those instructions into developer-speak.

So, anyway, if you are running Mac OS X and you already know how to use Terminal and adb, then here are instructions for you:

(These instructions are based on those at http://androidforums.com/threads/step-by-step-root-walkthrough-for-huawei-fusion-2.685504/.)

  1. Download https://www.dropbox.com/s/qtc37pley0vinj8/Huawei-Fusion-2-Recovery-Root.zip and extract the contents.
  2. Open Terminal and cd to the extracted Huawei-Fusion-2-Recovery-Root/Huawei-Fusion-2-Recovery-Root directory
  3. Turn off phone
  4. Reboot phone into fastboot by holding Volume Down and Power buttons simultaneously for 10-20 seconds. (It will freeze at the AT&T logo.)
  5. Connect phone to computer.
  6. Type fastboot devices to verify phone is connected.
  7. Type fastboot flash recovery recovery.superrecovery.img
  8. After it finishes, unplug phone.
  9. Remove back of phone, remove battery, wait 15 seconds, then re-insert battery and attach back.
  10. Hold Volume-Up and Power button simultaneously until it boots into recovery (15-20 seconds of holding both buttons)
  11. In recovery menu, select the "reboot device" option with the volume buttons (it should already start with reboot highlighted) and press the power button to reboot.

After that, you will "have root". So if you use adb shell to get a command shell on the device, you can run su to get superuser privileges. There is also a new SuperSU app on the phone.

But that's not really what I wanted. What I want to do is run adb shell <some-command> from the Mac. If you read the adb documentation, you might think you can run adb root to enable that, but you will just get an error message saying "adbd cannot run as root in production builds".

One needs to install an alternative version of adbd. I downloaded and installed this one from Google Play: adbd insecure. There is an option to have it automatically grant superuser access at boot, and I enabled that.

My HTC One Review

I've been an iPhone user for the past five years, except for a few weeks in 2011 when I used an Android phone to see how good it was. At that time, my evaluation was that Android was a second-rate knock-off of iOS.

But, with the releases of Android 4.0 "Ice Cream Sandwich" and 4.1 "Jelly Bean", Android got a lot less ugly, and hardware is finally fast enough that it doesn't feel so slow. Because I make about half my income from Android app development, I decided it was time to give Android another try as my personal phone. I vowed to put the iPhone away, buy a top-of-the-line Android phone, and use it for at least 12 months. My goal was to immerse myself in the Android ecosystem and learn how "regular people" use their Android phones.

When I made this purchase in July, the two top-tier Android phones were the Samsung Galaxy S4 and the HTC One. I've hated the two Samsung devices I've owned (Samsung Galaxy S and a Samsung Galaxy Tab 2 7.0), so it was an easy choice.

I won't re-hash the things that all the other HTC One reviews say. These are my personal impressions, and what I do and don't like about the HTC One may not match your preferences.

Trying Out CyanogenMod on a Samsung Galaxy Tab 2 7.0

Last year, I bought a Samsung Galaxy Tab 2 7.0 for use as an Android development/testing device. I didn't expect it to be good, and it wasn't. It was slow, clunky, and ugly in comparison to the iPad, just like every other Android tablet. But it was cheap, and I only used it to test apps I was developing, so it didn't bother me much.

Earlier this year, it finally got an upgrade to Jelly Bean, which improved the slow/clunky aspects, but it still wasn't good. I bought a new Nexus 7 in July (which is an awesome Android tablet), so I went to gazelle.com to see what they would give me for a used Galaxy Tab 2 7.0. Their offer: $16.

So, it went into the old-devices drawer. I kept it only because I might need it in an emergency if my Nexus 7 died at the worst possible time.

When all the news and drama about CyanogenMod (CM) broke last week, I decided I would give CyanogenMod a try. I was curious, and I had a device available to "sacrifice".

And you know what? That crummy old Galaxy Tab 2 7.0 is actually a pretty nice tablet with CM installed. I now have an Android 4.2.2 Jelly Bean tablet without all the Samsung TouchWiz crapware. It's not as good as the Nexus 7, but it no longer feels like junk, and it might stay out of that drawer for a while.

If you have an Android device in your junk drawer (or a Kindle Fire, or a NOOK), you might want to give CM a try. Read on if you're interested.

Transferring Ringtones from iTunes to an HTC One

I had some ringtones purchased from iTunes that I wanted to put onto my new HTC One. Googling for instructions found many hits, but many of those pages were a few years old, so the instructions didn't work anymore, or they didn't work with the HTC One, or were six-minute-long YouTube videos. So, I'm writing up some simple instructions that worked on my HTC One. (They will probably work with other Android phones, but I'm not promising anything.)

First, on your computer with iTunes, find the ringtones you want to transfer. These will be files with a .m4r extension. On my Mac, they were in the directory /Users/kdj/Music/iTunes/iTunes Music/Tones.

Next, you need some way to get the files onto your device's /sdcard/Ringtones directory. If you have a Windows computer, I think you can just plug the phone into the computer and it will be mounted as a USB drive, so you can just drag and drop the files. If you have a Mac, you can either use the Android File Transfer application, or use something like Dropbox.

Finally, you need to change the filename extensions of the files in /sdcard/Ringtones from .m4r to .m4a.

Then, on the device you can go to Settings > Sound > Ringtone, and you should see your ringtones in the list.

Customizing Android Action Bar for Edit Mode

I spent a long time trying to get a contextual action bar (CAB) working for an editing mode in an Android app I'm developing. My goal was to have a CAB appear whenever the user started changing field values on a screen, and the user would tap the Done button when complete. The CAB would also show a "Revert Changes" button allowing the user to undo whatever they did.

This initially seemed like the easiest way to indicate to the user that they had made changes and needed to explicitly save them, but Android's default implementation of CAB has some drawbacks:

  • The standard button is titled "Done". I would prefer it to be "Save", but there is no easy-to-use setTitle() method available.
  • If user hits the BACK button, the CAB disappears, and there is no straightforward way for the app to determine whether the CAB disappeared because the user hit Done or because they hit BACK, or any way to intercept the processing of the BACK button while a CAB is displayed.
  • I have to write code to restore the CAB state on a configuration change

While browsing around the web trying to find examples of workarounds for these issues, I ran across a blog post explaining why using a CAB for this scenario won't work, even if I did fix the aforementioned problems:

Edit Mode and why using a Contextual ActionBar is a bad idea

(Short version: If user double-taps or long-presses an edit field, it will pop up its own text-selection CAB which would blow away my CAB and eventually lead to a NullPointerException.)

So, I'm not using a CAB, but will instead customize the look of the non-contextual action bar as suggested in that blog post.

Android SDK Tools 22.0.1 Considered Harmful

After finishing up some work on an iOS app today, it was time to go make equivalent changes to the Android port of that app. "I'll just update my Android SDK before I get to work," I said (to myself). I opened the Android SDK Manager and let it update these SDK packages to these versions:

  • Android SDK Tools: 22.0.1
  • Android SDK Platform-tools: 17
  • Android SDK Build-tools: 17

Then I let Eclipse update the ADT. Then I got to work. I opened my Android app project and tried to run it. I found I couldn't make a working debug build or a release build, nor could I create a signed APK to install on a device.

After a few hours of hair pulling, I got everything working. Here is what I learned. I hope it helps someone.

My Android Development Cheatsheet

If I had my druthers, I'd spend all my time developing mobile apps. I've always been fascinated with pocket-sized computers, and have owned many through the years. Unfortunately, for most of my life such devices have been little more than toys, and so I've had to focus my expertise on writing code for "real computers".

This is true even now, during the explosion of smartphone and tablet usage. I'm one of those dinosaurs who knows how to use C, C++, MFC, ATL, CORBA, UNIX, and other ancient magic, so there are sometimes a few months of old-school development between mobile-development gigs. I write iOS stuff for fun, so I keep those skills sharp, but Android is something I touch only when I'm being paid to do so. Thus, I have to find a way to quickly get back up to speed when the Android work does come.

This is my little refresher for when I arrive back in Android-land. It may not help you at all.

WARNING: The below was written back when I wrote apps that targeted Android 2.x. A lot of it is obsolete with the 4.x API. Someday maybe I'll update this.

My Visit to Android-land

I've been a happy iPhone and iPad user for a while, but I'm currently involved in developing Android applications, so I decided to buy an Android phone to use for a few weeks. It's important to understand the user-interface conventions and user expectations for whatever platform you are developing for, and I figured that the only way to learn those things would be to take the plunge and immerse myself in Android for a while.

The following is a self-indulgent review of what I've found. If you are an Android fan, you will probably summarize it as "Surprise! Apple fanboy doesn't like Android," and you can just stop reading here.

Native Apps vs. Web Apps

This week, there was a lot of chatter in the blogosphere about the prospect of writing web apps for the iPhone instead of developing native apps.

Android: Maybe Not

A couple of days ago, I said I was considering giving up on iPhone development and trying Android instead. Here are my further thoughts along those lines.

Syndicate content