Preface: In the master Cloud XDA Forum on the xposed framework are known as "Android first Artifact" by many developers. What is the magical ability to get it off the list of apps? This article will guide you to complete a xposed on the simplest demo, let everyone feel the ability of xposed.
First, the mobile environment
1.Root Android phone (based on the phone model root, this article no longer detailed)
2. The xposed framework is installed (can be downloaded from here without the xposed frame)
Second, the principle
xposed replaced the/system/bin/app_process executable file, loading additional jar files when starting zygote (/data/data/ De.robv.android.xposed.installer/bin/xposedbridge.jar), and perform some initialization operations (Xposedbridge
Iii. Development of Xposed module
1. Add a jar Package
To add Xposedbridgeapi-54.jar to the Libs folder, there are no jar packages available to download here:
2. Importing the JAR Package
Add a statement under Build.gradle dependencies: (The contents of the single quotation mark are the path of the actual jar package)
Compile files (' Libs/xposedbridgeapi-54.jar ')
3. Modify the Androidmanifest.xml file
<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android " package=" Com.example.administrator.xposeddemo "> <application android:allowbackup=" True " android:icon=" @mipmap/ic_launcher " android:label=" @string/app_name " android:supportsrtl=" True " android:theme=" @style/apptheme "> <!--as xposed module-- <meta-data android:name=" Xposedmodule " android:value=" true "/> <!--module Description-- <meta-data android:name=" Xposeddescription " android:value=" module description "/> <!--xposedbridgeapi Minimum version number-- <meta-data Android:name= "xposedminversion" android:value= "si" /> </application></manifest>
Three meta-data tags are added mainly under application.
Xposedmodule is represented as a module under Xposed, and the value is true.
Xposeddescription represents the description of this module, which is displayed under the installed program name.
Xposedminversion represents the minimum version number of the jar package, and we are using 54.
4. Create a new class test, which implements the Ixposedhookloadpackage interface with the following code:
Package Com.example.administrator.xposeddemo;import De.robv.android.xposed.ixposedhookloadpackage;import De.robv.android.xposed.xposedbridge;import de.robv.android.xposed.callbacks.xc_loadpackage;/** * Created by Administrator on 2016/5/10. */public class Test implements Ixposedhookloadpackage { @Override public void Handleloadpackage (xc_ Loadpackage.loadpackageparam Loadpackageparam) throws Throwable { //print loaded APK package name XposedBridge.log ("Launch App: "+ Loadpackageparam.packagename);} }
This class overrides the Handleloadpackage method in the interface by performing certain operations on the parameter Loadpackageparam in the method to hijack the actual running apk, where we simply print the package name.
5. Specify the operating entry for the module
Create a new Assets folder under/app/src/main/:
Under this folder, create a new file named "Xposed_init":
Write the entrance to the test class in Xposed_init:
6. After signing the program key, generate the APK and install it on the phone.
Note: As far as possible signature after the APK installation, debug run sometimes not.
Notification bar will appear when the installation is complete, click "Activate and restart"
The demo will appear under the Xposed framework module after reboot:
View the Logcat information tagged "Xposed" under 7.Android Studio:
As we expected, LOGCAT can see the various app package names we launch.
For full source download please click here.
Xposed Module Development Introductory Tutorial