Wednesday, January 9, 2008

Asynchronous Service Example

Many folks have been asking about asynchronous services (using the Binder) in Android and I decided to whip up a quick example showing how this is intended to work with the current SDK (m3-rc37a). There are rumors from Google that they will be improving things soon and providing a better example, but in the mean time this example should clear up a lot of the confusion:

AsyncService.tar.gz

UPDATE: The project must be built using ant (not Eclipse) because of an SDK bug regarding the invocation of the aidl tool. There are also reports that even ant won't work on Windows due to yet more bugs in aidl. The code does work as Google intended, though, and in the next SDK release they are committed to having these issues resolved.

UPDATE2: Google released m5-rc14 and, as promised, the bugs are fixed and their included RemoteService example has been updated to show similar functionality.