Google posted an article about Android compatibility yesterday. In summary, you can query if an API exists and if not, avoid calling it and do something else.
People usually talk about compatibility where an existing older application can run on a newer version of the OS, not (as in the case of the Google article) a newer application running on and old version of the OS. Developers and consumers have come to expect that an older application should run on a newer version of the OS. In fact, OS authors go to extraordinary efforts to allow this to happen. Many developers rely on this and develop for the earliest version they can so that they don’t have to develop different binaries for different phones.
As an example, the S60 and Windows Mobile application I am working on now is created using S60 3rd (MR) and Windows Mobile 5 respectively. Although these are older SDKs, I know the application will work on most later phones. If I were to pick later SDKs then my binary wouldn’t necessarily work with phones using the OS prior to the SDK.
The downside of this is that you don’t get any bug fixes and new features that you get with using the newer SDKs. With Android and the techniques mentioned in the article it’s possible to use a newer SDK (with its new features and bug fixes) and still run the application on older versions of the OS. In terms of development, that’s a major gain over Symbian OS (S60), Windows Mobile and the iPhone. This might, over the long term, help reduce the number of different applications required vs the number of versions of the OS i.e. Fragmentation of the OS.
However, it’s important to distinguish between the Android OS being compatible in this way vs the application. You still can’t call into APIs that don’t exist. It’s up to the application to determine if the API exists before making a call. The onus is on the application, not the Android OS to provide the compatibility. If developers don’t use this facility then applications will still break when run on older phones. This is similar to the LiPS (now deceased) dynamic discovery mechanism I commented on two years ago.