Messager
Reference to a Handler, which others can use to send messages to it. This allows for the implementation of message-based communication across processes, by creating a Messenger pointing to a Handler in one process, and handing that Messenger to another process.(Messager对象指向一个Handler,其他进程可利用Messager发消息给Handler。
实现了基于消息传递的进程间通信,通过在一个进程中创建指向Handler的Messager,并把这个Messager暴露给另一个进程。)
1 | private final Messenger mMessenger = new Messenger(mIncomingHandler);//创建指向名为mIncomingHandler的Handler的Messager |
(后来发现以上所写Messager实现的未必是进程间通信,因为Service在默认情况下在UI线程内的)
(应该可以在android manifest中将该service的process属性设成别的或者直接调用其他应用的service)