For C2DM to work, a device clearly must be at API level 8. However, does this really require that the application be compiled at that level? None of the code to work with C2DM requires any APIs at level 8. So would it be possible to have an app at a lower level, maybe API level 4 or 6, and have it try to do the C2DM registration? Maybe the registration fails on devices that are at a lower API level, and hopefully this can be detected so that an alternate mechanism could be used. However, shouldn't registration succeed for a device at API level 8 or higher? What I'm trying to do here is take advantage of C2DM while still compiling at level 4, so that my app can reach the most number of users. Ideally this is possible, and I can detect when the device is not capable of C2DM, and react accordingly.
A:
You can use android.os.Build.VERSION.SDK
I believe to determine the highest level API the device supports and handle API 8 and <8 separately without requiring the user to be at a certain API level to install the app.
Dan
2010-10-30 23:23:37