Android Foundation--messenger in cross-process communication

Source: Internet
Author: User

The use of Messenger in cross-process communication

Pre-stated:

I am also a beginner, so this article is from a beginner's point of view, if there are inappropriate places please leave a message to teach me, thank you.

This article is intended to explain the use of Messenger and the principle of Messenger on the application layer and the Messenger's response on the server.


What is Messenger?

Messenger can be translated as Messenger, Messenger is a lightweight IPC scheme through which you can pass a message object in a different process and put the data that we need to pass in the message to achieve the process of data transfer.

Step one: Use of Messenger

Service-Side authoring:

Configure the service in manifests:

Writing the client (in another application):

Start the activity on the server and turn on the service:

Then start the client and view the test results:


Step Two: The principle analysis of Messenger on the application layer

We follow the creation method of Messenger, to see the source code can be known, the bottom is the use of Aidl:

About the use of aidl and the principle of analysis, here refer to my CSDN blog, which has detailed analysis, Android Basics--The beginner must know aidl on the application layer of the binder mechanism, http://blog.csdn.net/qq_30379689/ article/details/52253413

Step Three: Messenger can accept the client's message after the reply, here is similar to the function of automatic mailbox reply

Android Foundation--messenger in cross-process communication

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.