AIDL is an abbreviation for the Android Interface definition language
Since the author is using Android studio, the location of the Aidl file should also be noted, in the Appname->main->aidl->packagename directory, the interface class file cannot be generated automatically
First, write our Aidl file, define the interface method, syntax is slightly different from Java
Secondly, we want to build the service class to implement the Aidl file name. The subclass of the stub class that implements the inherited method.
Returns an instance of this subclass in the Onbind method
Register the service and give it an action, which is the ID of the service to be accessed later
In activity, by intent set up action and Bindservice method to start the service, it is important to note that Android5.0 service in the intent must be explicit declaration, so we have to give intent set up our present package name, use the context of the getpackagename, and establish a serviceconnection instance, the method of implementing the instance, in Onservi The Ceconnected method can be used to obtain a subclass instance of the service pass through its parameter service.
With this example, we can invoke the method that serves the instance of the child class.
The above is a simple tutorial on the establishment and use of AIDL services.
Android Remote Services (AIDL) Implementation steps