Project requirements: 1. Create a system application TestAPP. The application starts a service after it is started. The service provides data interfaces for other applications.
2. Add a method to the acitivity source code and call the TestAPP method in the system application for data interaction.
1. Add the aidl file under the frameworks/base/core/java/android/app/directory:
IHelloWorld. aidl:
Package android. app;
Import java. lang. String;
Interface IHelloWorld
{
Void printHelloWorld ();
Void printString (String string );
}
Note:
(1) The package declaration of this file should be: package android. app;
2. Modify the Android. mk file under frameworks/base:
In "LOCAL_SRC_FILES + = \", see how to add IAlarmManager:
Core/java/android/app/IAlarmManager. aidl \
Add the following content at the end of "LOCAL_SRC_FILES + =:
Core/java/android/app/IHelloWorld. aidl,
Note:
(1) Add "\" to the end of the line above core/java/android/app/IHelloWorld. aidl.
3. After compiling framewor, find the classes. jar file under framework_intermediates under the \ out \ target \ common \ obj \ JAVA_LIBRARIES \ path (source code root path.
4. Add a new User Library in eclipse. For example, the name is android-lib (you can name it yourself)
5. Set this android-lib to System library and import the classes. jar file. (my colleague said that the System library is selected to allow the jar file to only be compiled and not run)
6. Add the new android-lib to the project, and set the order of android-lib to be higher than Android4.4 in Java Build path (for specific versions, refer to the project)
After completing the preceding steps, you can apply AIDL to the project.
If you want to use your own parcelable class in AIDl
The FriendInfo. java class implements Parcelable.
Generate FriendInfo. aidl in the same directory
For more information, see PendingIntent in frameworks/base/core/java/android/app /.
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + CsztvNPN6rrzo6zQ6NKq1No8L3A + large/dPDPC9wPgo8cD4KPGJyPgo8L3A + CjxwPgqyzr + small "http://www.2cto.com/uploadfile/Collfiles/20140329/2014032910513826.jpg" alt = "">