0

So I have a library that drives external devices over bluetooth or wifi. The library was written by another party and I cant really change it.

There will be multiple android applications controlling the device. Separate APKs and separate processes. The act of connecting/reconnecting cant be done when the user switches apps. So my thinking is to basically wrap the library in a service that runs in its own process and the client applications can bind to that.

This presents a few interesting problems. The data objects in the library are not Parcelable or Serializable. There are not that many but they support generics and wrapping them all would be very time consuming.

There are also a few dozen objects which basically represent interfaces for controlling specific aspects of the device each with 2-12 methods each. Maybe I could wrap each of these using AIDL.

I want to make using the service as similar to using the library directly as possible.

I feel like wrapping a third party library as an AIDL service is probably not all that uncommon for Android developers. Does any one who has faced this before have any suggestions?

startoftext
  • 3,846
  • 7
  • 40
  • 49
  • "I feel like wrapping a third party library as an AIDL service is probably not all that uncommon for Android developers" -- my guess would be 1 developer in ~2,000 might need to do this. – CommonsWare Jul 15 '13 at 18:03
  • @CommonsWare Way to make me feel special ;-) I think I have run across some of your tutorials before and if I remember correctly they were helpful. – startoftext Jul 15 '13 at 23:13
  • "Way to make me feel special ;-)" -- each of us is special, in our own special way. :-) Seriously, your situation is pretty unusual. First, you're writing a suite of apps designed (apparently) for off-the-shelf hardware, and most developers aren't doing that. Second, your library is stateful in a way that the suite of apps cares about, and relatively few libraries would have that limitation, as most libraries are specifically designed to only care about the current process, not something going on elsewhere on the device. 1 in 2000 seems reasonable. That being said, it's an icky problem. – CommonsWare Jul 15 '13 at 23:16

0 Answers0