Hello,

In my application I have a need to separate components into two
different APKs.
One component (the first APK) needs to communicate with a service
provided by the other component (the second APK).

I was hoping I could use the shared-user-id mechanism, have both
applications run in the same process and by so avoid AIDL using the
same scheme as presented in the LocalService example in the ApiDemos.
The idea was to declare the following two classesin APK #1:
"LocalService" interface: would represent the service
"LocalServiceBinder": would have a "getService()" method that would
return a "LocalService" object
The two classes would be exported into a JAR and added to APK #2's
build path.

The actual service in the APK #2 would implement "LocalService" and
it's "onBind()" method would return an instance of
"LocalServiceBinder" whereas "getService()" would be overriden to
return a reference to the service itself.

I tried implementing it but failed due to a class-cast exception being
thrown in "onServiceConnected" when attempting to cast the Binder
returned by the Service to LocalServiceBinder. I gave up on the idea
and implemented the communication using AIDL.

As a result my application took quite a performance hit, primarily due
to the "serialization" and "deserialization" of the data being sent to
Service.
So now I'm again trying to implement the "local-communication" scheme.
However, when I tried to reconstruct the aforementioned implementation
the Binder received in "onServiceConnected" is null (even though I'm
definitely not returning null in the service's "onBind" method).

Bottom line is I would like to know if whether I'm attempting to do is
even possible using the Android framework, and if so how to do it. If
not, any suggestions on how to minimize the performance hit.

Thanks in advance!

Best regards,
Uri Kanonov
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to