简体   繁体   English

Android 没有aidl的远程服务?

[英]Android Remote Service without aidl?

Is it possible to write Remote Service in Android without aidl? Android 没有aidl可以写Remote Service吗? If yes - is it better to use then aidl?如果是 - 那么使用 aidl 会更好吗?

No. If you want to write a remote service, you will -- at some level -- be using code very similar to AIDL.不会。如果您想编写远程服务,您将在某种程度上使用与 AIDL 非常相似的代码。 While AIDL is used for generating the stubs and packaging data, you can also use a Messenger and Handler pair: but this is simply implemented on top of AIDL, so you're using it anyway.虽然 AIDL 用于生成存根和打包数据,但您也可以使用 Messenger 和 Handler 对:但这只是在 AIDL 之上实现的,所以无论如何您都在使用它。 For simple exchanges, a Messenger and Handler pair works, but for more complex situations using AIDL is appropriate.对于简单的交换,可以使用 Messenger 和 Handler 对,但对于更复杂的情况,使用 AIDL 是合适的。 If your question is whether there is a lighter communication mechanism (other than just Intents) than AIDL, the answer is no.如果你的问题是是否有比 AIDL 更轻量级的通信机制(除了 Intents),答案是否定的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM