Thursday, June 23, 2011

What will you do when you have an xyz.aidl file to use ??

You need to be pretty sure whats an aidl file and whats the point in using them ! Yes, an aidl file is the interface through which we can perform an IPC. Since each application runs in its own VM (dalvik vm), each process has its unique user id and its restricted to access data or the memory part of the other processes. For example, if your app needs to communicate with the call application of the phone's process you need an interface through which you can communicate. People familiar with marshalling & unmarshalling will have the idea of the purpose behind. To put them in simple words : "they need to decompose their objects into primitives that the operating system can understand, and marshall the objects across that boundary for you. The code to do that marshalling is tedious to write, so Android handles it for you with AIDL" - from the docs.

Fine, if you are well aware of the aidl's purpose you can get it working in your test application. All that you need is to obtain the xyz.aidl from the correspoding repo. (Whenever you need it -> sync it from the google code repo -> use tortoise svn (win 32 client)). As soon as you sync it, cpy that aidl file along with its package structure ( and place it in your src file. After adding it there, open eclipse and refresh your project. If it has not been added yet, then perform a clean and make sure the particular interface gets added in your project explorer.

Once that is listed, you can make use of the interface and call the functions directly from the local thread. You can notice the file generated in the project explorer.

1 comment:

  1. For more info :