Formatting an SD card as exfat

December 17, 2015

On Android, by default SD cards with 64M or more on them are formatted as exfat, while smaller cards are formatted as fat32. But what if you want to force an SD card to be exfat? Here’s how to do it. You’ll need a Linux box.

  1. sudo apt-get install fuse-exfat exfat-utils
  2. Partition the card if it’s not already partitioned
  3. sudo mkfs -texfat /dev/sdf1

Mostly this post is to remind me that the new format is called exfat, since I keep forgetting that.

Renaming an Android shortcut in TouchWiz (the hard way)

February 23, 2014

Warning: the information presented below might break your phone. It’s quite easy to make a typo and delete all your shortcuts… which will leave you pretty much up the creek. I probably should have backed up launcher.db before I did all this, but I didn’t. Shame on me. So don’t do this unless you know what you’re doing. If you break things it’s not my fault.

I recently switched from using Astro File Manager to ES File Explorer. In almost all respects, ES File Explorer is a better file manager – but it has one significant shortcoming. In Astro, you can create a shortcut and specify its name at create time; in ES File Explorer your shortcut is named whatever the file was originally named.

This left me with ugly file names (including extension) on the home screen. I needed a way to rename. Lots of articles on the web pointed to apps that would do it, but it seemed unnecessary to have to download a whole other app just to rename something. In the end I figured out how to do it.

To start with, you’ll need the following (all of which I had installed on my phone already):

Incidentally, my phone is a Samsung Infuse running Froyo… other phones may be different, and I don’t think you’ll find TouchWiz on non-Samsung phones.

First, I had to locate where the TouchWiz database was on my phone. This thread on xda-developers pointed me to /dbdata/databases/

So… start up Terminal Emulator and do:

$ su
# cd /dbdata/databases/com.*twlaunch*
# pwd
# ls

Groovy, there’s the launcher.db in the right place. Next I inspected it with sqlite3:

# sqlite3 launcher.db
SQLite version
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
CREATE TABLE android_metadata (locale TEXT);
CREATE TABLE apps (_id INTEGER PRIMARY KEY,componentname TEXT,top_number INTEGER NOT NULL DEFAULT 65535,page_number INTEGER NOT NULL DEFAULT 65535,cell_number INTEGER NOT NULL DEFAULT 65535);
CREATE TABLE favorites (_id INTEGER PRIMARY KEY,title TEXT,intent TEXT,container INTEGER,screen INTEGER,cellX INTEGER,cellY,INTEGER,spanX INTEGER,spanY INTEGER,itemType INTEGER,appWidgetId INTEGER NOT NULL DEFAULT -1,isShortcut INTEGER,iconType INTEGER,iconPackage TEXT,iconResource TEXT,icon BLOB,uri TEXT,displayMode INTEGER);
CREATE TABLE gestures (_id INTEGER PRIMARY KEY,title TEXT,intent TEXT,itemType INTEGER,iconType INTEGER,iconPackage TEXT,iconResource TEXT,icon BLOB);

My educated guess based on the tables and what was in them was that the table “favorites” would be useful. Not only did it have a title and an intent, but cellX, cellY, spanX and spanY looked like things that might be used for shortcuts.

From there it was simple to look at what was in the table:

sqlite> select * from favorites;

Luckily, it looks like shortcuts are added by _id, and the number for _id increases as new shortcuts are added. That means the latest shortcut added is probably going to be at or near the end.

So… update the record and see what happens:

sqlite> update favorites set title="VE Manual" where _id=149;
sqlite> .quit

Then go back to the launcher and look at my shortcut. Boo, it’s still the same as it was. So then kill TouchWiz by holding “Home”, clicking the “Ram Manager” tab, pressing the “Level 2” button and then the “Clear Memory” button… success! The shortcut is renamed. Tapping it causes the same behaviour as before… in all respects it’s the same shortcut, just the title has changed.

Incidentally, I ran into what looks like a problem with doing this. If I rename the shortcut then reboot, the shortcut loses its icon information. I think this has something to do with ES File Explorer being stored on SD. Strangely, it doesn’t happen when I don’t rename the file. Astro fills in the icon BLOB, but ES File Explorer doesn’t.

Android superuser not coming up

June 17, 2013

I ran into a weird problem on an Android 2.2 (Froyo) phone that I had. Although it was rooted, and Superuser was installed, su wouldn’t come up. Trying to root it again with SuperOneClick didn’t seem to work either. Starting Titanium Backup (which worked in the past) yielded “asking for root rights”, and trying to run Terminal Emulator and su just hung.

Finally, I stumbled my way to something working. I ran SuperOneClick 2.3.1 first. I turned off the “automatically start” option of LBE Privacy Guard. I rebooted, then ran ADB shell and was able to get root from there:

C:\super1click\adb\adb shell
$ su

From there, I figured out what device /system was:

# cat /proc/mounts

From this I determined that /system was mounted on /dev/block/stl9, so:

# mount -ro remount,rw /dev/block/stl9 /system
# chown root.root /system/bin/su
# chmod 6777 /system/bin/su

At this point, I was able to start su and do the “check for update”. su determined that it was out of date, and downloaded a new version, fixing the permissions as it did so. (6777 is a little lax, but I couldn’t remember what su was supposed to be.)

I have no explanation as to why su would break. I have no explanation why this would fix it, but it did for me. Maybe it will for you as well.

Solving Youtube “Cannot Play Video” on Android

June 20, 2012

Recently, my phone entered a state where it would “sort of crash” when I tried to play Youtube links using the internal Youtube app. I could play in Flash fine, but if I opened the same link with the Youtube app, it would:

  1. vibrate twice
  2. vibrate again
  3. open a dialog titled “Cannot play video” with the text “Sorry, this video cannot be played”

Lots of users have seen this, but there weren’t too many solutions. I started out by uninstalling and reinstalling the Youtube app. No luck there. Then I found
this AndroidCentral thread and in particular Sumabot’s post.

That set me down the right path. I didn’t want to wipe out as much as he did, but I did do this:

  1. Open the web browser
  2. Menu -> More -> Settings
  3. Clear Cache
  4. Clear history
  5. Clear all cookie data
  6. Clear location access
  7. Reset to default

I might just have needed to “Reset to default” – if it happens again that’s what I’ll try next.

Update: I’ve figured out that opening a Youtube video in another window (regardless of cache state) will cause the browser to crash. In my case, just clicking on the link (as opposed to long-pressing and saying “Open”) seems to work.

Installing new certificates on Android

May 12, 2012

Recently I’ve encountered a website that is using the certificate “Verisign Class 3 Secure Server CA – G3”. Unfortunately, my Android device (Samsung Infuse running Froyo 2.2.1) doesn’t know about that certificate, so I get a warning.

Installing a certificate on this device is not hard, but there are one or two tricks.

First, download the certificate. For me it was a Verisign certificate. I did a search on the certificate title and determined it corresponded to the Verisign cert SVRSecureG3.cer, so I went to and grabbed it. (Note that .cer is the certificate and .crl is the certificate revocation list.)

Once you have the .cer, it’s unfortunately in binary mode. Use openssl (which is included as part of Cygwin for Windows users) to convert it to a .crt:

$ openssl x509 -in SVRSecureG3.cer -inform DER -out SVRSecureG3.crt -outform PEM

Install that .crt on the root of the removable SD card. For Samsung devices, this means it will have to be in /mnt/sdcard/external_sd/.

Go to the Settings app, and select “Location and security”, then “Install encrypted certificates”. You will be prompted with a dialog for the Certificate name; I just took the default. Click “OK”.

You’ll be prompted to enter a password for credential storage. Do not forget this password.

At this point, the credential has been imported. Next time you visit the website, you should not get a bad certificate.

Rooting the Samsung Infuse with SuperOneClick

May 6, 2012

After spending ages trying to root my Samsung Infuse (i997) running Android 2.2 with SuperOneClick on my Windows XP box, I finally did the right thing: blew it away and installed Windows 7. With that, I was able to root the Infuse this afternoon.

I used:

After rooting, I rebooted the device. It worked with no problems. I shot the developer of SuperOneClick a donation ’cause why not.

Later I installed TitaniumBackup, which gave me a warning message about the access rights to su and offered to correct it. I said to go ahead and it did:

Access rights on the “su” binary were successfully correced from “0:2000 [6755]” to “0:0 [6755]”. Please reboot your device for the changes to apply.

I think that changed it from to root.root.

At any rate, now I know I can root the Infuse.

I wasn’t able to root an Infuse running 2.3.5 Gingerbread. Instead I had to use this XDA post, Odin, and reflash a new ROM.

Migrating from Palm to Android: essential apps

November 30, 2011

I’ve been gradually moving from Palm to Android. In some ways this is a step back, because Android is a lot less polished than Palm. On the other hand, it’s a platform where people are actually writing code.

My perspective is a little different from most: I didn’t want to rely on Google to sync my calendar, contacts, etc. I wanted to do that myself. Palm makes it easy; Android makes it hard.

I’m running a Samsung Infuse with Android 2.2.1 currently. Here are the apps I’ve discovered so far to make the Android experience easier. Because I’m cheap, they’re all free unless otherwise noted:

  • The calendar app is the most obvious place where Android flunks. I’ve been able to get by with aCalendar for calendar display. It is a lot like the Palm app, and is actively supported. Android also sucks with alarms, so I use Calendar Event Reminder (paid app, around USD 2.50) so I get more than a single “ding” when the alarm goes off. Finally, I use iCal Import/Export to get my calendar events out to the SD card. This is no longer supported by its author unfortunately. It relies on unsupported API as well to get calendar data – but so far that’s the only one. (I heard from the author of aCalendar that he’s thinking about adding export code, though, so there may be hope there. He’s got a Pro verison due out soon, and I’m hopeful. I’ll definitely pay for it when it comes out.)
  • To see a percentage representation of battery life (similar to what you’d get on a Palm when you tap the battery icon) I use Battery Indicator.
  • I had Noah Pro on my Palm, so I wanted a good dictionary app. ColorDict Dictionary Wikipedia includes all of Noah Pro, and additional files and the ability to do web searches if you’re online. Very nice. (One hint: you need to install dictionary files separately, then run them before you can use them. Looks like a lot of Android users can’t figure that one out.)
  • Of course, you’ll need Graffiti for the real experience. I was happy enough with it that I went to the paid version, Graffiti Pro.
  • I had Yaps for password storage on the Palm. I eventually migrated to KeePassDroid. Here are more details about migrating from Yaps to KeePassDroid.
  • Android search is also pretty lame, especially in contacts. I use Power Search when I really want to find something.
  • On Palm, I loved EasyCalc. The best calculator I’ve found so far is RealCalc Scientific Calculator.
  • For games, I installed the Ken Magic Solitaire, since it seemed least likely to want to leak my info all over the world.
  • To back up applications themselves, I use ASTRO File Manager. This app is able to copy existing apps that don’t have the copy-prevent bit set onto the SD card.
  • Finally, to copy all the files up to a server, I use the SAMBA client AndSMB rather than messing around with USB or swapping out SD cards.
  • I’ve installed Memento Database as a replacement for JFile, but so far have not transferred my data over, so I can’t say how good it is.

The most surprising thing is the app I haven’t found a replacement for yet – the Notepad! All the apps I have seen so far want to sync to the cloud, rather than letting me export to SD. Bummer. I did use What’s for Dinner Premium for my notes which are recipes, and I think it’s great. (I got this free on the Amazon app store for their free app of the day; normally it’s about USD 2.00.) Right now I’m using the Samsung Memo app (installed with their Android builds) for the rest, but it can’t export so I’m not using it for much. If you know of a Notepad app that doesn’t want network access, please let me know in the comments.