Androidstudio enabling the binding of remote service via Aidl

Source: Internet
Author: User
Reprint example schematic this article, in a simple case, records how to use Aidl to implement interprocess communication: First, create two projects, one project (Remoteservice) as the remote service provider, the other (remoteservicetest) As a client that invokes a remote service. Then, when the client binds the remote service, it can invoke the method in the remote service through the Aidl interface, the principle process remote Service Remoteservice Project

1. Create the Aidl file, select the package name that contains the service class you want to provide, right-click the file, Aidl. Aidl, New--

Here the Aidl file is named Remoteinterface, after creation, a Aidl folder is generated under Main, and a package name is the same as the package name just selected, and a remoteinterface.aidl is generated under the package.

2. Open the Remoteinterface.aidl file, define an interface method Remoteprintinterface (); To recompile the project, click Build-->make Project (you can also point directly to the arrow), and if successful, a Remoteinterface interface file will be generated in the following directory
Note Do not modify this interface file, the interface has an important stub class, is to be used later, the stub class inherits the binder, and implements the Remoteinterface interface.

Ii. Creating engineering Application projects using remote services Useremotedemo Engineering:

1. Copy the Aidl folder in the main directory of the Remotedemo to the main directory of the Useremotedemo project;

Androidstudio enabling the binding of remote service via Aidl

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.