5

What is the standard way to use RPC in Android? The official way to do RPC in Android seems for me AIDL. Is that correct?

First of all I am quite new to Android. But the start is good. I am warming up with the functions I already know from Java. Now I want to go further and use some advanced techniques with some of my already existing software in Java.

Here’s the scenario. I have a little Java server which runs an object orientated version of RPCs called SIMON. Now I want to combine it with Android. Means on an Android device I want to run a little app as client which gets its information from my server.

I read some instructions to program a client and a server for android. But both are running on android which I don’t want to.

Does anybody know how to combine RPC between Android and Java? Maybe some links or hints in which direction I can search should do the trick. Right now I am a little bit lost and combine these two worlds.

I have already came across REST, JSON, XML-RPC, SOAP who needs external libraries I don’t want to use. I want to stick with the standard way of Android to keep it “Original” Android. Whatever. The pure Android code is my goal in this stage.

4

3 回答 3

1

据我所知,没有“标准”方法可以从 Android 向服务器执行 RPC。您提到的 AIDL 用于对同一设备上的另一个进程执行 RPC。

正如您所发现的,有大量的序列化格式和库支持它们在 Android 应用程序和服务器之间进行通信 - 所以请选择。

我没有证据证明这一点,但我猜绝大多数开发人员会在 HTTPS 上使用 JSON,可能是 REST,也可能不是。但是使用 Avro、gRPC、Protocol Buffers、Apache android-json-rpc 或其他任何东西也没有错 - 使用最适合您的情况的任何东西。

于 2020-10-12T02:43:14.267 回答
0

我也在寻找一种在 android 中进行远程 RPC 的简单方法。经过一番搜索,我终于使用Apache Avro完成了这项任务。

于 2012-09-20T16:15:04.757 回答
0

GRPC:https ://grpc.io/

服务器端和客户端实现都有一个学习曲线,但是,它在代码生成方面是健壮和严格的。我从来没有遇到过任何问题。

于 2020-05-12T21:22:57.480 回答