Thanks Mark On Dec 2, 4:29 pm, Mark Murphy <[email protected]> wrote: > On Thu, Dec 2, 2010 at 6:23 PM, Rohan <[email protected]> wrote: > > Bump. > > Any tips for me? > > I don't think what you literally asked for ("make a backwards > compatible AIDL") is possible. > > What should be possible, though, is to support two different AIDL versions.
I was hoping I wouldn't have to do this because of the extra maintenance overhead, but if this is the case I still have a question below. > > I have not tried this, so your kilometerage may vary, but here is what > I would try: > > Step #1: Create a new AIDL file with a new name to go along with your > existing AIDL file. > > Step #2: Create a distinct Intent format for use with bindService() to > request the new AIDL. For example, if you are presently using <action > android:name="com.myfirm.SERVICE" /> to identify your service to other > apps, add a second element like <action > android:name="com.myfirm.SERVICE_V2" />. > > Step #3: Create .Stub implementations for each of the two AIDL files, > routing to some common implementation where needed. Adding new functions following steps 1-3 could be done in 2 ways: 1) Copy all the existing functions to the new aidl, and calling through to the same functions as the orignal Stub implementation was for existing functions. 2) Adding only new functions to the new aidl, and binding to the service through both aidl's. You seem to be suggesting option 1; so is there any reason I wouldn't want to use option 2? > > Step #4: In onBind(), examine the Intent you get, and based on the > discriminator you introduced in Step #2, return the corresponding > IBinder from Step #3. > > This extends indefinitely, so you can be backwards-compatible as long > as you want, deprecating the older AIDL. If you have analytics in your > app, you might consider logging the usage of each AIDL version -- once > an old one becomes unused, announce you are dropping it, then drop it > sometime thereafter, to reduce your code maintenance burden. > I will also add a wrapper class over my aidls which each application will call in to, and isolate the fact that the aidl's are changing across versions (app developers just see an updated API in the wrapper class). > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 3.0.1 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

