Android’s New Public APIs in ICS

 

 

Since Android is open-source, anyone can look at the code and see how it works inside. If you do this, you’ll notice that most but not all of the APIs arepublicly documented.

If they’re publicly documented, they’re part of what we consider the Android Application Framework. This means their tests appear in the Compatibility Test Suite (CTS) so that our hardware partners have to prove that the APIs work, and that we promise to try very hard not to change them and thus break your code.

In almost every case, there’s only one reason for leaving APIs undocumented: We’re not sure that what we have now is the best solution, and we think we might have to improve it, and we’re not prepared to make those commitments to testing and preservation.

We’re not claiming that they’re “Private” or “Secret” — How could they be, when anyone in the world can discover them? We’re also not claiming they’re forbidden: If you use them, your code will compile and probably run. And in fact we know of quite a few apps out there whose developers have used undocumented APIs, often to good effect. It’s hard to get too upset about this in cases where there’s a useful API that we haven’t gotten around to stabilizing.

But the developers who use those APIs have to be prepared to deal with the situation that arises when we move them from the undocumented outside into the Android Application Framework. Fortunately, this is reasonably straightforward. Also we take a close look at Android Market, using our in-house analytics tools, to get a feel for the impact when we know one of these changes is coming.

There are a few such changes coming up in the Android 4.0 “Ice Cream Sandwich” (ICS) release of Android. We wanted to take the opportunity to combine these words on undocumented APIs with some specifics about the changes.

Calendars

Let’s start with the good news: As of ICS, the Android Framework will include a fully-worked-out set of APIs for accessing Calendar data. You can guess the bad news: Quite a few developers have built apps (including many good ones) using the undocumented Calendar APIs, some using fairly low-level access to the calendar database. Unfortunately, these integrations were unsupported, and prone to breakage by platform updates or OEM customization of calendar features.

We want to see lots of good calendar apps and extensions that work reliably across Android devices, and aren’t broken by platform updates. So we decided to create a clean API, including a comprehensive set of Intents, to manage calendar data in ICS. Now anyone can code against these new APIs and know that Android is committed to supporting them, and that partners have to support these APIs as part of CTS.

Once the new APIs arrive, you’re going to have to update your apps before they’ll run correctly on ICS while still working on older releases. There are a variety of techniques for doing that, many of which have been featured on this blog, including reflection and lazy loading. Recently, we introduced Multiple-APK support, which could also be used to help with this sort of transition.

Text To Speech

Android has never really had a text-to-speech API at the Framework level, but there was unofficial access at the C++ level. With ICS, we will have a fully-thought-through application-level API running on Dalvik, so you can access it with ordinary Java-language application code.

The old C++ API will no longer be supported, but we’ll have a compatibility layer that you can use to bridge from it to the new API. We think it should be easy to update for ICS with very little work.

Doing the Right Thing

We recognize that this means some work for developers affected by these changes, but we’re confident that Android programs in general, and both Calendar and TTS apps in particular, will come out ahead. And we also think that most developers know that when they use undocumented APIs, they’re making a commitment to doing the right thing when those APIs change.

 

Automatically Detect Roads with Bing Aerial Imagery

We’re excited to announce access to an experimental service which can automatically derive street vector data from Bing aerial imagery. Simply put; this means you can derive the position and curves of a road by specifying the end points. Here’s a simple video to demonstrate what’s happening;

We’re looking forward to see what the developer community does with this, especially editors of OpenStreetMap. You can find the service and documentation here. Let us know how you like it!

Making Data Accessible – Or Why TIGER/Line Is Now on WeoGeo

Getting at Free Data

I’ve talked quite a bit over the past few years about how one can make data easily accessible and usable by users. TIGER/Linehas been one of my biggest examples. The web interface is a nightmare in usability and the FTP site is hard to use (and who really wants to download 150 GB of data?) unless you’ve got those FIPS codes memorized. There has to be a better way to access this data.

OK So Let’s See What This Thing Can Do

When I joined WeoGeo almost 2 years ago, we were working on adding vector support to the already powerful raster customization options. We’ve had vector support for a while now, but only recently had we added what we call ToC support so that you can manage large datasets such as this TIGER/Line 2009. ToC gives WeoGeo the ability to deliver many different shapefiles (or any other supported data type) as individual layers allowing someone to customize their order. In the case of TIGER, one could only get the hydro layer and only have to download that dataset. This means that you don’t need to get gigabytes of data to access lakes in your area of interest. One could of course download everything, but many times you just need one part of the dataset.

So I Work Across County Boundaries

TIGER County data is of course organized by county.  In many regions, the reasons why these county boundaries were created have no bearing on reality or the facts on the ground.  So organizing data by county might make sense to some mathematician sitting in a cubicle in the bowels of some government building, but to those of us who need to work with the data it is nothing but an impediment to building our products.  The ToC (which is just a JSON file) gave us the means to offer up TIGER/Line 2009 data for the USA. Unlike the TIGER/Line website, you can easily select across counties and states for your data in one download. If I want Portland, OR and Vancouver, WA, it is a simple order. I don’t have to navigate through Oregon to Multnomah County and then back out to Washington and THEN back down to whatever county Vancouver, WA is in (seriously how do you figure that out on their website?). The clicks involved are just nuts.

Get Multiple County TIGER Downloads for Free

Take this example below; I can order all the TIGER/Line data between New York City and Philadelphia (including all those counties in New Jersey), select only the layers I want, clip it to my area of interest, re-project it and even deliver it in another format (such as TAB files).

How many trips through the TIGER/Line website would it take to grab all that data?

Grab only the TIGER layers you want, leave the junk behind.

Thus, WeoGeo is now hosting the entire TIGER/Line 2009 (TIGER/Line 2010 will come out as more states are added) for everyone to use. Because this dataset is about 150 GB, we are subsidizing the cost of hosting and delivery ourselves for basically anything smaller than the State of New Jersey1. This means that I can grab the Los Angeles Metropolitan area and get every TIGER/Line shapefile for free. Not a bad resource considering that you can place that order in less than one minute.

What is that? Census data for like 17 million people. For free!

So Yea, I’m Excited

Yup! Having the TIGER/Line 2009 Layers in WeoGeo and making it available free to users solves some of the problems I’ve seen with federal data sharing websites. While I do think hosted basemaps such as Bing and Google Maps are the future, having some free local data is still very valuable to those who need data unencumbered by licensing. And you can use our REST API to access this data outside of the website or with our MapInfo and ArcGIS connectivity.

Amazon put TIGER/Line 2008 on AWS a couple years ago and then let it die.  We’ll keep our archive of 2009 and soon 2010 up for those who need it in the Amazon Cloud.

In addition, we’ve got lots of other datasets available for free on our Market including the whole FCC geo-databasenatural hazard rankingsNational Land Cover and Natural Earth Data. If you’ve got some good suggestions of free data that we should be including in our WeoGeo Market, please don’t hesitate to contact me via my email address which is located at the top of the sidebar on the right.


1: As much as I’d love to let you all download the whole thing as much as you wish, I still have my son who wants aniPad this Christmas. We just want to cover our costs here.