4

Not being patient enough for the Mono for Android book I started going through the Android programming constructs and translate them to the Mono infrastructure. Seems like most the time the good folks at Xamarin and I think along similar lines so progress has been relatively pain free but on the AIDL issue I'm stuck. Was AIDL implemented? If so, how can I use it? If not, what is the recommended way to use IPC?

Shy
  • 401
  • 1
  • 5
  • 15

2 Answers2

7

AIDLs are finally supported. To use them add aidl files into your project and set Build Action to AndroidInterfaceDefinition. Xamarin.Android will generate cs files, that are compiled together with your source code, so you can use aidl interfaces in your c# code. VS2012 still marks them as unknown/errors in code, but in the end, code is compiled and working.

Michal Dobrodenka
  • 1,104
  • 8
  • 27
4

AIDL is, lamentably, something that isn't readily supported at this time. It is only supported via Java Interop Support; that is, you'd need to:

  1. Write your .aidl files.
  2. Compile the .aidl files into .java files (possibly as a pre-build step?).
  3. Include the generated .java files into your build by adding them to the project and setting their build action to AndroidJavaSource.

Of course, for parcels you'll need to implement them...in Java, and for services you'll likewise need to write some Java code.

The documentation on Java Native Interop Support may be useful as well.

In all, not very elegant. Not difficult, but not elegant either.

Consequently, the recommended way to do IPC is to use Intents, BroadcastReceivers, and ContentProviders (depending on the needs of your IPC), and avoiding the use of parcels; use Strings and other builtin types instead.

jonp
  • 13,512
  • 5
  • 45
  • 60