Android远程进程:messenger vs aidl?哪个更好?
我目前有一个远程服务,可以与同一应用程序上的活动不断进行通信。
有时我需要大量传入和传出消息。哪种消息传递方法更好、更快且省电?使用消息或aidl接口?
截至目前,我正在使用 aidl 接口,但出于某种原因,我认为特别是在附加侦听器时会产生很多开销......
非常感谢任何反馈。
I currently have a remote service that communicates constantly with an activity on the same app.
I need to send messages in and out extensively at some times. Which method of messaging is better, faster, and battery friendly? Using messages or aidl interface?
As of now I'm using aidl interface but for some reason I think there is a lot of overhead specially when attaching listeners...
Any feedback greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
远程服务通常不是一个好主意。
然后使用更少的内存。音频播放器不需要超过每个进程的 RAM 限制,即使有活动也是如此。
这并不是浪费设备 RAM 和 CPU 时间的特别好的理由。这对于服务器来说是一个很好的方法,但对于嵌入式系统来说就不那么好了。
它们应该具有相当的可比性。 IPC 考虑因素应该会淹没大多数其他影响。例如,引用我自己的一本书中的内容:
话虽这么说,如果您担心开销(但坚持使用远程服务),那么尝试这两种方法并使用日志记录来确定是否有明显的赢家可能会更好。
A remote services is generally not a good idea.
Then use less memory. A audio player should not need to exceed the per-process RAM limits, even with activities.
This is not a particularly good reason for wasting device RAM and CPU time. That's a fine approach for a server, less so for an embedded system.
They should be fairly comparable. IPC considerations should swamp most other effects. For example, quoting myself from one of my books:
That being said, if you are concerned about the overhead (yet insist on the remote service), you are probably better served trying both and using logging to determine if there is a clear winner.