Android

Surviving the limited memory of the Nexus One


I bought the Nexus One pretty much as soon as it became available, and have been loving the pure Google Android nature of the phone since, with one (perhaps 2 - the 1400mAh battery) exceptions. The internal system memory available for applications, and application data is fine for a few apps, but once you start to rely on a suite of applications, and install some of Google’s own memory hogs (Google+, Maps, etc) you rapidly run into issues.

The device has 512MB of flash, of which 190M can be used for application and data storage, plus a microSDHC card slot which can support up to 32GB - however some applications can’t be installed to this SD memory in the native build. 

Updated: 23rd Nov with info on A2SD+ from Lance.

Finding out what’s burning the space

There are 2 apps I’ve used to discover where all of your space is going.

  • 1Tap Cleaner will let you clear your app cache to give you more space + also allows you to sort apps by data size (or app size, total size etc). 
  • DiskUsage is a really nice graphical viewer that will let you visualize what’s using which areas. It will show you for each app how the space is being used for data, apk (the app itself), and dalvikCache

App2SD

The simplest and safest initial tactic is to use App2SD to help identify the apps that have allowed themselves to be moved to SD. App2SD will scan your whole system for apps that can be moved, and keeps an eye on any new installs, helpfully offering to move the apps right after you’ve installed them. I think this is sometimes referred to as the F-A2SD or Froyo Apps2SD method - because apps are able to run from the native fat32 partition on the SD card.

There are 2 things that limit the gain from this technique

  • Some apps are flagged as ‘don’t move me to SD’. This can be mitigated by rooting your phone - which I think allows you to move more of the flagged don’t move apps to flash.
  • App data remains in internal memory while the program itself is moved to SD.

That said, this method served me well for the first year of using the device.

Root + CyanogenMod

The next level of complexity (and benefit) comes from unlocking the bootloader, rooting, and then installing a 3rd party build of Android - in my case the CyanogenMod nightly builds. This gives you access to more tools that can help free up even more room (and offers the ability to move some of the previously stubborn apps to flash).

As part of the process of installing ROM Manager + CyanogenMod, you’ll find an option to perform a backup of your phone (known as a nandroid backup). Don’t skip this step, and don’t forget that you’re backing up to the SD card - so take a copy of this backup on your PC.

Uninstall Android system apps that you don’t need

You can’t uninstall system applications from the system menu, but they can be removed using a file-manager with root permissions. The most popular is Root Explorer ($3.95), but there are free alternatives. Personally I’m happy to pay for a 5* application when it is messing with my system on this level.

Install the app, open the setup menu, and enable root function, then grant superuser privileges.

Now you can browse to /system/app, set R/W (for read-write), and delete the apk files for the system-apps you no longer need. Note that you won’t be able to reinstall these from the market - so you should take a backup of the apk first.

Convert system apps to user apps, and move to SD

If you still want to keep a few system apps, but would prefer to move them to the slower (but larger) SD card, you can simply convert them to normal apps by moving the APKs from /system/app to /data/app. After rebooting and if they still work, you can try to move them to the SD card with App2SD (or the applications preferences screen as usual). 

Not all apps will work in this manner - so make sure you’ve got a full backup first, and don’t try moving key parts of the system (such as the keyboard!).

Create an ext partition on the SD card for apps

This step provides you with the greatest gain, however it also comes with the greatest pain - because the act of re-partitioning the card will erase everything on it - so start by taking a making backup copy of the SD card (and your phone using a nandroid backup as described above) to your PC. 

This process let you create a partition on the SD card that acts like internal memory, not external memory. By default, your SD card is formatted to fat32 - which makes it easy to read/write on a PC, and Android can read/write files to it, but most apps won’t run from it or store their data on it. An ext (ext2, ext3 or ext4) partition on the other hand is a standard UNIX partition, and can be treated as internal memory.

I used ClockworkMod recovery (from ROM Manager) to partition my SD because I already had that from the CyanogenMod installation. This let me create a 512M (or smaller) partition, which should be enough for most users. Either Armon Ra recovery or a Linux boot disk will let you customize the size of the ext partition (but don’t go larger than 2G).

I then used an app called S2E to mount the ext partition as ext4 on reboot, and set read-buffer to 2MB as recommended. I believe you can also use Link2SD to mount the partition. This lets you get access to the partition from the phone.

I understand from Lance Robson that a script known as A2SD+ is available within some custom ROMs or as an after-the-fact install that automates much of this process, however I think moves your whole /apps folder over to the SD card. If you want to try this route - search for Darktremor Apps2SD or FroYo a2sdext.

What to move to the ext partition?

Then you need to move things to the sd-ext partition. This is where I get a little less clear about what to move to maintain good performance.

You can ask S2E to relocate the whole /data/app and /data/private-app folders to the sd-ext folder, and then any app you install to “Internal memory” will automatically get shifted to the ext partition (and hence the SD card).

However after reading Roy True’s post on G+ indicating that some apps don’t perform too well from an ext partition, I decided to start with the dalvik cache and download areas. The dalvik cache is an area that stores optimized bytecode versions of your apps to make execution faster than if they had to unpack the APK every time. S2E let me move these into the sd-ext partition with no trouble.

Moving app data files

Now at this point I’ve already got around 70 MB of space on internal memory - so I’m doing well, but when I next run out of head-room, I’m going to need MORE. I can already shift apps individually over to the SD card using App2SD as usual, however this only moves the app, not the data associated with the app - which in the case of some apps (Google+ I’m looking at you! ) can be huge.

Thankfully there’s a trick using symbolic links (a bit like a pointer or redirect). You can shift the app’s data directory into /sd-ext, and create a symbolic link back to the app’s native folder. You could probably do this by hand - but an app called Titanium Backup will do it for you.

To enable this, according to the FAQ you need to create a folder called app in your sd-ext folder (although I’m not 100% sure this is necessary… ), then run Titanium Backup and long-click the app in question and select move app-data to SD.  On my system this created a folder in sd-ext called data2, and moved the data there, linking back to the app’s main data directory.

Conclusions…

Here are the key folders now on my phone…

Internal system user-space - limited to 190M 

  • /data/app - Applications - apk
  • /data/data - Data for those applications

Internal system area - 120M on my phone 

  • /system
  • /system/app - System Applications

Ext folder 433M = a mount point for the ext folder on the SD card (pretending to be internal memory)

  • /sd-ext/app - not used
  • /sd-ext/dalvik-cache
  • /sd-ext/data2 - the app data files that have been moved over from internal memory
  • /sd-ext/download - download folder

The main SD partition is mounted as /sdcard. Note that you won’t be able to see the ext folder from here as this is a separate partition.

  •  /sdcard/Android/data - Applications that have been moved to the SD card

Ok - so I’m not 100% sure that I’ve found the best path here, but my phone is certainly running faster, and I’ve got a lot more headroom than I had before, plus nothing has crashed on me (yet). 

Let me know if you spot a gap in my method above - or a way to simplify the task.

Google Me - The future of social networking?

There’s been plenty of debate over what Google Me will be when it launches - and I’ve certainly not read all of it. I do however believe that Google is in the best position to create a killer and yet open social network.

My idea of a perfect social network at this point would be 

  • Open identity - to allow me to login with my OpenID
  • Ability to create and share status updates, photos, videos, and links to any of the social networks that my friends are using
  • Ability for my friends to comment and interact with my activity streams such that I get the comments back on my original item - back in my preferred social network
  • One list of contacts that I can segment into groups and transport between social networks and my email/phone
  • Location based checkins, with my locations available to a select group of my friends

Here’s why I don’t think facebook, twitter or foursquare will win this in the long run:-

Facebook

Facebook has the first-mover advantage of having a the largest number of users (over 500 million in July 2010), and it’s also great for supporting conversations - but only between your Facebook friends within the system - which of course serves to pull in more users.

I think Facebook will continue to be closed in spirit - because they want to control the world’s social information. They’re spreading tentacles into site across the web (including this one) in order to be able to aggregate a huge amount of data about your likes, and those of your friends - that they can then use to build up an very detailed picture of each of us for their advertisers.  They seem to be working with the open social movement, have committed to activity streams and  positioned facebook connect as open, but I get the impression that they’re only going as far as it suits them.  

Twitter

Twitter is open in that messages are public by-default, and through twitter search or one of the many clients like hootsuite, you can listen in on the conversation and jump in when you spot a key-word you’re interested in.  One of the major downsides of the platform though is that conversations are terribly hard to follow between more people than just you and one other.  There’s no concept of the threaded conversation.

Twitter have also so far not agreed to provide their ‘firehose’ or full feed via PubSubHubBub - so that other sites may interact with it, probably because adding their support (and users) to this open real-time publishing mechanism would serve to threaten their particular differentiator.

Foursquare and GoWalla

Foursquare and Gowalla have great location-based capabilities, but they’re not that useful to me as standalone applications - because the effort required to sign into yet another application or web-service is too much for most people to use. Only 4% of my facebook friends are on foursquare.  Foursquare only has around 2 million users, vs Facebook’s 500 million (or 0.04%).

Diaspora

Diaspora is a wild-card which could indeed provide an open and de-centralized social network, but they’re going to have a really hard time competing with facebook’s dominance - even with the fact that it’s a distributed network. I suspect that it will turn out to support a group of open-social-network-chimps, rather than a gorilla - and won’t come close to toppling Facebook or Google. I hope they succeed in at least pushing Facebook to be more open and honest… and I’ll certainly be joining Leo in creating an account when they open the doors.

Google

Google’s stated aim is to organize the world’s information… Note that they don’t want to own it, they just want to organize it (and sell ads against it). I think you get an understanding of this when you look at Google Places on android. They do allow you to add your own business directly to Google places, but they also grab data from independent review sites like qype - and integrate the information seamlessly into the Places app. I’ve often spotted my qype reviews popping up in response to a Google Places search.

If you think about how they might extend this concept to integrating activity streams from all of your online presences into Google Me - they could build a central hub that supports innovative niche services such as foursquare - rather than trying to replace them. I think this is how they’re going to start anyway - because it will make it much easier to kick-start the network effect by hooking into our existing social services and social graph.

Photos and video are of course the things that people share the most, after links on social networks - and Google have Picasa and YouTube - which they’ve (eventually) tied to your Google account. These services are pretty well designed with all of the capabilities a photo and video sharing site should have - putting them one step ahead of facebook.

Google have gmailmobile, and voice - all of which provide a great understanding of who my real friends are (people I talk to on the phone, and send emails to on a regular basis) and is something that twitter and facebook don’t.  Combine this with a good understanding of my social graph via the XFN tools - and a little bit of clever user-experience design work - and Google could easily help me to build a set of friend-groups that would be much more effective than facebook’s friend lists.

Google Buzz, whilst not being a particularly social network to date - is probably one of the most open - especially since they’ve added the firehose capability - publishing feeds in real-time via PubSubHubBub. If you also consider that something like 200 million people have a gmail (and therefore potentially a Buzz) account - they certainly have a good foundation to build from.

Nick O’Neill asks the question - Will Android Trump Facebook as the Social Operating System?, which is an interesting one if you think about it. The most sensible place for your social network to run from is the smart-phone - because it’s always with you - knows your location, and is also the device you probably make most of your voice calls on these days. I’ve been very impressed at the way that Android pulls together all of my contacts from Outlook/Exchange, Facebook, Twitter and Gmail into one unified contacts list - which checks of one of my ideal social network requirements.

The rate at which Android is growing is somewhat staggering - with 200,000 devices being activated each day (Aug 2010), making Android a significant part of the Google Me platform.

With the Google Profiles and Buzz as the foundation, with the promise of Android, I’m really excited about the potential of Google Me.