开发者

How do I Connect to remote service from a different .apk

First of开发者_高级运维f I have seen this:

Remote Service as apk

And it does not help me at all. Here is the deal. I have one apk that creates a remote service (call it A). I then have another apk (call it B). How can I connect B to A without include the AIDL file or a jar file. I would think that this would be possible.

** UPDATE **

So I have copied the AIDL file into B and created an to the service in A for the AIDL file. I can conntect to the remote service, and bind to the service now. However when I try to call a method that exists in the service I get:

java.lang.SecurityException: Binder invocation to an incorrect interface

Having trouble finding any help on this. Any ideas?

** PROBLEM SOLVED ** The AIDL file had to be in a package with the same name in the project B. Thanks for your help Peter.


You have to know the format of the data that is sent between two separate processes. This is needed for serialization/deserialization of the data to Java objects.

AIDL is a description language to describe the structure of objects.

So, you have two options:

  1. Either you have an AIDL, or

  2. your code explicitly know the format to do the de-/serialization. This is the implementation of Parcelable. This implementation could be inside a jar that you include in your app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜