Scaling Android successfully involves mastering multiple areas, including handling device and user diversity as well as your app’s content, according to Mike Shaver, director of mobile engineering at Facebook, in his keynote yesterday at AnDevCon.

Shaver, who manages the teams that build Facebook’s core Android and iOS applications as well as its mobile websites, shared how the company handles key issues to scale Android. These issues include number of users, diversity of devices, amount of content within the app, and the opportunity mobile Android development presents for developers in general.

“Facebook’s in a pretty unique position with respect to the scale of our application and a bunch of other pieces,” Shaver said. “If you look at the rate of growth of Android, things that are leading-edge…right now, are going to be middle-of-the-road, maybe not in the Top 50 on the App store in a couple of years. So, the problems that we’re facing and the opportunities that we’re seeing are ones that you may well see before you might otherwise expect; the growth here is pretty impressive.”

Facebook is an app of an unusual size in a number of ways, Shaver said. “One of the most important ones is we just have a lot of people using it,” he said. “When you ship client software normally, there’s not a lot of incremental cost. But there’s a bunch of stuff we do on the server as well that actually has the content, so there’s a bunch of support we have to provide there.”

Shaver said that their app is used in a lot of different ways. “People have different content mixes, they have different preferences, they’re on different networks, they have different priorities. We get great combinations like, you have a big screen and you have a really [poor] network, what size photos do we send you?” He said that some carriers, in an effort to reduce the bandwidth that Facebook uses, will recompress the images for them.

Because of how widely Facebook is used on mobile devices, and because of limitations on mobile networks, Shaver said that Facebook’s data usage is really important. Every carrier has told him that the app uses too much data. “How much data should Facebook use? The answers are not as forthcoming,” he said. “And it is a lot of content, it is a lot of photos especially, and it is something that we really have to keep track of.”

Facebook also deals with the scale of what Shaver calls “diversity.” “Android presents a rainbow of software and hardware environments in which your application might find itself unexpectedly,” he said. “We actually ran out this sort of chart of what our tail looks like. We take the most popular 100 Android devices that use our app, and we get to right about a third of our users—and then the tail gets ridiculously long.”

Facebook, Shaver said, wants to provide a user experience that ideally matches your device. “If you’re on a Nexus 7 tablet or the Nexus 4 or the Samsung S35, you’re going to expect something that’s a little richer (than someone on a low-feature phone),” he said. “It also means we hit pretty much every quirk that’s out there on Android.”

Hardware acceleration on many devices was another area that Shaver discussed. “If you hardware-accelerate the container in which your WebView appears, it will work pretty well and will get accelerated, but you will no longer be able to apply Transforms or scaling,” he said.

Shaver also discussed the ongoing trend of using Android 2.3 (Gingerbread) and the number of users that will bring. “The majority of Android devices in the world are Gingerbread…and we generally track the market there. We’re going to see new Gingerbread devices for a long time…because the hardware you need to provide a Gingerbread experience is pretty inexpensive. And a lot of Android growth is happening in places where ‘pretty inexpensive’ is mandatory.”