import{_ as l,r as o,o as p,c as i,b as n,d as c,a,e as s}from"./app.f643a53b.js";const r={},t=a(`<h1 id="\u5FEB\u901F\u5F00\u59CB" tabindex="-1"><a class="header-anchor" href="#\u5FEB\u901F\u5F00\u59CB" aria-hidden="true">#</a> \u5FEB\u901F\u5F00\u59CB</h1><blockquote><p>\u96C6\u6210 <code>YukiHookAPI</code> \u5230\u4F60\u7684\u9879\u76EE\u4E2D\u3002</p></blockquote><h2 id="\u73AF\u5883\u8981\u6C42" tabindex="-1"><a class="header-anchor" href="#\u73AF\u5883\u8981\u6C42" aria-hidden="true">#</a> \u73AF\u5883\u8981\u6C42</h2><ul><li><p>Windows 7 \u53CA\u4EE5\u4E0A/macOS 10.14 \u53CA\u4EE5\u4E0A/Linux \u53D1\u884C\u7248(Arch/Debian)</p></li><li><p>Android Studio 2021.1 \u53CA\u4EE5\u4E0A</p></li><li><p>IntelliJ IDEA 2021.1 \u53CA\u4EE5\u4E0A</p></li><li><p>Kotlin 1.7.0 \u53CA\u4EE5\u4E0A</p></li><li><p>Android Gradle Plugin 7.0 \u53CA\u4EE5\u4E0A</p></li><li><p>Gradle 7.0 \u53CA\u4EE5\u4E0A</p></li><li><p>Jvm 11 \u53CA\u4EE5\u4E0A (Since API <code>1.0.80</code>)</p></li></ul><h2 id="\u81EA\u52A8\u6784\u5EFA\u9879\u76EE" tabindex="-1"><a class="header-anchor" href="#\u81EA\u52A8\u6784\u5EFA\u9879\u76EE" aria-hidden="true">#</a> \u81EA\u52A8\u6784\u5EFA\u9879\u76EE</h2><p><code>YukiHookAPI</code> \u63D0\u4F9B\u4E86\u4E00\u4E2A\u81EA\u52A8\u5316\u6784\u5EFA\u5DE5\u5177\uFF0C\u5B83\u53EF\u4EE5\u5E2E\u52A9\u4F60\u5FEB\u901F\u6784\u5EFA\u4E00\u4E2A\u62E5\u6709 Xposed \u6A21\u5757\u4F9D\u8D56\u7684 Android \u6807\u51C6\u9879\u76EE\u6A21\u677F\uFF0C\u4F7F\u7528\u6784\u5EFA\u597D\u7684\u6A21\u677F\u5373\u53EF\u76F4\u63A5\u5F00\u59CB\u4E0B\u4E00\u6B65\u5DE5\u4F5C\u3002</p><p>\u4F60\u53EF\u4EE5 <a href="../tools/yukihookapi-projectbuilder">\u70B9\u51FB\u8FD9\u91CC</a> \u8FDB\u884C\u67E5\u770B\u3002</p><h2 id="\u624B\u52A8\u914D\u7F6E\u9879\u76EE" tabindex="-1"><a class="header-anchor" href="#\u624B\u52A8\u914D\u7F6E\u9879\u76EE" aria-hidden="true">#</a> \u624B\u52A8\u914D\u7F6E\u9879\u76EE</h2><p>\u82E5\u4F60\u4E0D\u60F3\u4F7F\u7528\u81EA\u52A8\u5316\u6784\u5EFA\u5DE5\u5177\uFF0C\u4F60\u4F9D\u7136\u53EF\u4EE5\u6309\u7167\u4EE5\u4E0B\u65B9\u5F0F\u624B\u52A8\u914D\u7F6E\u9879\u76EE\u4F9D\u8D56\u3002</p><h3 id="\u521B\u5EFA\u9879\u76EE" tabindex="-1"><a class="header-anchor" href="#\u521B\u5EFA\u9879\u76EE" aria-hidden="true">#</a> \u521B\u5EFA\u9879\u76EE</h3><p>\u4F7F\u7528 <code>Android Studio</code> \u6216 <code>IntelliJ IDEA</code> \u521B\u5EFA\u65B0\u7684 Android \u9879\u76EE\uFF0C\u5E76\u5728 <code>Language</code> \u4E00\u680F\u9009\u62E9 <code>Kotlin</code> \u4EE5\u81EA\u52A8\u6DFB\u52A0\u57FA\u7840\u4F9D\u8D56\u3002</p><h3 id="\u96C6\u6210\u4F9D\u8D56" tabindex="-1"><a class="header-anchor" href="#\u96C6\u6210\u4F9D\u8D56" aria-hidden="true">#</a> \u96C6\u6210\u4F9D\u8D56</h3><p>\u5728\u4F60\u7684\u9879\u76EE <code>build.gradle</code> \u4E2D\u6DFB\u52A0\u4F9D\u8D56\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">repositories {</span></span>
<span class="line"><span style="color:#ADBAC7;">    google()</span></span>
<span class="line"><span style="color:#ADBAC7;">    mavenCentral()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757\u82E5\u4F60\u7684 Plugin \u7248\u672C\u8FC7\u4F4E\uFF0C\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u52A1\u5FC5\u6DFB\u52A0\uFF0C\u5176\u5B83\u60C5\u51B5\u53EF\u9009</span></span>
<span class="line"><span style="color:#ADBAC7;">    maven { url </span><span style="color:#96D0FF;">&quot;https://dl.bintray.com/kotlin/kotlin-eap&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u52A1\u5FC5\u6DFB\u52A0\uFF0C\u5176\u5B83\u60C5\u51B5\u53EF\u9009</span></span>
<span class="line"><span style="color:#ADBAC7;">    maven { url </span><span style="color:#96D0FF;">&quot;https://api.xposed.info/&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// MavenCentral \u6709 2 \u5C0F\u65F6\u7F13\u5B58\uFF0C\u82E5\u65E0\u6CD5\u96C6\u6210\u6700\u65B0\u7248\u672C\u8BF7\u6DFB\u52A0\u6B64\u5730\u5740</span></span>
<span class="line"><span style="color:#ADBAC7;">    maven { url </span><span style="color:#96D0FF;">&quot;https://s01.oss.sonatype.org/content/repositories/releases&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u5728\u4F60\u7684 app <code>build.gradle</code> \u4E2D\u6DFB\u52A0 <code>plugin</code>\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">plugins {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u52A1\u5FC5\u6DFB\u52A0\uFF0C\u5176\u5B83\u60C5\u51B5\u53EF\u9009</span></span>
<span class="line"><span style="color:#ADBAC7;">    id </span><span style="color:#96D0FF;">&#39;com.google.devtools.ksp&#39;</span><span style="color:#ADBAC7;"> version </span><span style="color:#96D0FF;">&#39;&lt;ksp-version&gt;&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u5728\u4F60\u7684 app <code>build.gradle</code> \u4E2D\u6DFB\u52A0\u4F9D\u8D56\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">dependencies {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u57FA\u7840\u4F9D\u8D56</span></span>
<span class="line"><span style="color:#ADBAC7;">    implementation </span><span style="color:#96D0FF;">&#39;com.highcapable.yukihookapi:api:&lt;yuki-version&gt;&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u52A1\u5FC5\u6DFB\u52A0\uFF0C\u5176\u5B83\u60C5\u51B5\u53EF\u9009</span></span>
<span class="line"><span style="color:#ADBAC7;">    compileOnly </span><span style="color:#96D0FF;">&#39;de.robv.android.xposed:api:82&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u2757\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u52A1\u5FC5\u6DFB\u52A0\uFF0C\u5176\u5B83\u60C5\u51B5\u53EF\u9009</span></span>
<span class="line"><span style="color:#ADBAC7;">    ksp </span><span style="color:#96D0FF;">&#39;com.highcapable.yukihookapi:ksp-xposed:&lt;yuki-version&gt;&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,21),d=s("\u8BF7\u5C06 "),u=n("strong",null,"<ksp-version>",-1),A=s(" \u4FEE\u6539\u4E3A "),v={href:"https://github.com/google/ksp/releases",target:"_blank",rel:"noopener noreferrer"},y=s("\u8FD9\u91CC"),m=s(" \u7684\u6700\u65B0\u7248\u672C "),b=n("strong",null,"(\u8BF7\u6CE8\u610F\u9009\u62E9\u4F60\u5F53\u524D\u5BF9\u5E94\u7684 Kotlin \u7248\u672C)",-1),D=s("\u3002"),B=a(`<p>\u8BF7\u5C06 <strong>&lt;yuki-version&gt;</strong> \u4FEE\u6539\u4E3A <a href="../about/changelog">\u8FD9\u91CC</a> \u7684\u6700\u65B0\u7248\u672C\u3002</p><div class="custom-container danger"><p class="custom-container-title">\u7279\u522B\u6CE8\u610F</p><p><strong>YukiHookAPI</strong> \u7684 <strong>api</strong> \u4E0E <strong>ksp-xposed</strong> \u4F9D\u8D56\u7684\u7248\u672C\u5FC5\u987B\u4E00\u4E00\u5BF9\u5E94\uFF0C\u5426\u5219\u5C06\u4F1A\u9020\u6210\u7248\u672C\u4E0D\u5339\u914D\u9519\u8BEF\u3002</p></div><p>\u5728\u4F60\u7684 app <code>build.gradle</code> \u4E2D\u4FEE\u6539 <code>Kotlin</code> \u7684 Jvm \u7248\u672C\u4E3A 11 \u53CA\u4EE5\u4E0A\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-groovy ext-groovy line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#ADBAC7;">android {</span></span>
<span class="line"><span style="color:#ADBAC7;">    compileOptions {</span></span>
<span class="line"><span style="color:#ADBAC7;">        sourceCompatibility </span><span style="color:#F47067;">JavaVersion.</span><span style="color:#6CB6FF;">VERSION_11</span></span>
<span class="line"><span style="color:#ADBAC7;">        targetCompatibility </span><span style="color:#F47067;">JavaVersion.</span><span style="color:#6CB6FF;">VERSION_11</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    kotlinOptions {</span></span>
<span class="line"><span style="color:#ADBAC7;">        jvmTarget </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&#39;11&#39;</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container warning"><p class="custom-container-title">\u6CE8\u610F</p><p>\u81EA API <strong>1.0.80</strong> \u7248\u672C\u540E Jvm \u7248\u672C\u9ED8\u8BA4\u4E3A 11\uFF0C\u4E0D\u518D\u652F\u6301 1.8 \u53CA\u4EE5\u4E0B\u7248\u672C\u3002</p></div><h3 id="\u4F5C\u4E3A-xposed-\u6A21\u5757\u4F7F\u7528" tabindex="-1"><a class="header-anchor" href="#\u4F5C\u4E3A-xposed-\u6A21\u5757\u4F7F\u7528" aria-hidden="true">#</a> \u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528</h3><p>\u5728\u4F60\u7684 <code>AndroidManifest.xml</code> \u4E2D\u6DFB\u52A0\u57FA\u7840\u4EE3\u7801\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-xml ext-xml line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#768390;">&lt;!-- \u8BBE\u7F6E\u4E3A Xposed \u6A21\u5757 --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposedmodule&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;true&quot;</span><span style="color:#ADBAC7;"> /&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#768390;">&lt;!-- \u8BBE\u7F6E\u4F60\u7684\u6A21\u5757\u63CF\u8FF0 --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposeddescription&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;\u586B\u5199\u4F60\u7684 Xposed \u6A21\u5757\u63CF\u8FF0&quot;</span><span style="color:#ADBAC7;"> /&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#768390;">&lt;!-- \u6700\u4F4E Xposed \u7248\u672C\u53F7\uFF0C\u82E5\u4F60\u6B63\u5728\u4F7F\u7528 EdXposed/LSPosed\uFF0C\u5EFA\u8BAE\u6700\u4F4E\u4E3A 93 --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposedminversion&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;93&quot;</span><span style="color:#ADBAC7;"> /&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#768390;">&lt;!-- \u53EF\u9009\uFF1A\u914D\u7F6E\u652F\u6301 New XSharedPreferences \u53EF\u65E0\u9700\u8C03\u6574 xposedminversion \u4E3A 93 --&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">&lt;</span><span style="color:#8DDB8C;">meta-data</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:name</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;xposedsharedprefs&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">android:value</span><span style="color:#ADBAC7;">=</span><span style="color:#96D0FF;">&quot;true&quot;</span><span style="color:#ADBAC7;">/&gt;</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u5728\u4F60\u7684\u9879\u76EE\u4E2D\u521B\u5EFA\u4E00\u4E2A Hook \u5165\u53E3\u7C7B\uFF0C\u7EE7\u627F\u4E8E <code>IYukiHookXposedInit</code> \u5E76\u52A0\u5165\u6CE8\u89E3 <code>@InjectYukiHookWithXposed</code>\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">@InjectYukiHookWithXposed</span></span>
<span class="line"><span style="color:#F47067;">object</span><span style="color:#ADBAC7;"> HookEntry </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">IYukiHookXposedInit</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onHook</span><span style="color:#ADBAC7;">() </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container tip"><p class="custom-container-title">\u5EFA\u8BAE</p><p>\u8BF7\u5728 <strong>onInit</strong> \u65B9\u6CD5\u4E2D\u914D\u7F6E <strong>YukiHookAPI</strong> \u5E76\u5C06 <strong>isDebug</strong> \u6A21\u5F0F\u8BBE\u7F6E\u4E3A\u5982\u4E0B\u5F62\u5F0F\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onInit</span><span style="color:#ADBAC7;">() </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> configs {</span></span>
<span class="line"><span style="color:#ADBAC7;">    isDebug </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">BuildConfig</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">DEBUG</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p><strong>YukiHookAPI</strong> \u9ED8\u8BA4\u4F1A\u6253\u5370\u6240\u6709\u7528\u4E8E\u8C03\u8BD5\u7684\u65E5\u5FD7\uFF0C\u82E5\u4F5C\u4E3A\u53D1\u5E03\u7248\u672C\u8BF7\u52A1\u5FC5\u5173\u95ED\u8C03\u8BD5\u529F\u80FD\u9632\u6B62\u5BF9\u7528\u6237\u8BBE\u5907\u9020\u6210\u5927\u91CF\u65E5\u5FD7\u586B\u5145\u3002</p><p>\u4F60\u8FD8\u53EF\u4EE5\u5C06\u4F60\u7684\u6A21\u5757 APP \u7684 <strong>Application</strong> \u7EE7\u627F\u4E8E <strong>ModuleApplication</strong> \u4EE5\u5B9E\u73B0\u5B8C\u6574\u4F7F\u7528\u4F53\u9A8C\u3002</p><p>\u66F4\u591A\u529F\u80FD\u8BF7\u53C2\u8003 <a href="../api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication">ModuleApplication</a>\u3002</p></div><p>\u7136\u540E\uFF0C\u4F60\u5C31\u53EF\u4EE5\u5F00\u59CB\u7F16\u5199 Hook \u4EE3\u7801\u4E86\u3002</p><p>\u6709\u5173\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u7684\u76F8\u5173\u914D\u7F6E\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u4F60\u53EF\u4EE5 <a href="../config/xposed-using">\u70B9\u51FB\u8FD9\u91CC</a> \u7EE7\u7EED\u9605\u8BFB\u3002</p><p>\u82E5\u4F60\u76EE\u524D\u6B63\u5728\u4F7F\u7528 Xposed API\uFF0C\u4F60\u53EF\u4EE5\u53C2\u8003 <a href="../guide/move-to-new-api">\u4ECE Xposed API \u8FC1\u79FB</a>\u3002</p><h3 id="\u4F5C\u4E3A-hook-api-\u4F7F\u7528" tabindex="-1"><a class="header-anchor" href="#\u4F5C\u4E3A-hook-api-\u4F7F\u7528" aria-hidden="true">#</a> \u4F5C\u4E3A Hook API \u4F7F\u7528</h3><h4 id="\u96C6\u6210\u65B9\u5F0F" tabindex="-1"><a class="header-anchor" href="#\u96C6\u6210\u65B9\u5F0F" aria-hidden="true">#</a> \u96C6\u6210\u65B9\u5F0F</h4><p>\u521B\u5EFA\u4F60\u7684\u81EA\u5B9A\u4E49 <code>Application</code>\u3002</p><div class="custom-container danger"><p class="custom-container-title">\u7279\u522B\u6CE8\u610F</p><p>\u65E0\u8BBA\u4F7F\u7528\u4EFB\u4F55 <strong>Hook Framework</strong>\uFF0C\u4F60\u90FD\u9700\u8981\u52A0\u5165\u5176\u5BF9\u63A5\u7684 Xposed \u4F9D\u8D56\u652F\u6301\u3002</p><p>\u82E5\u76EE\u6807 <strong>Hook Framework</strong> \u6CA1\u6709\u96C6\u6210 Xposed API \u4F60\u9700\u8981\u81EA\u884C\u5B9E\u73B0\u5E76\u5BF9\u63A5 <strong>XposedBridge</strong>\u3002</p></div><p>\u5728 <code>attachBaseContext</code> \u4E2D\u6DFB\u52A0 <code>YukiHookAPI.encase</code> \u65B9\u6CD5\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">attachBaseContext</span><span style="color:#ADBAC7;">(base</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Context?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u88C5\u8F7D Hook Framework</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">//</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">//</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// \u88C5\u8F7D YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase(base) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.attachBaseContext(base)</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u7136\u540E\uFF0C\u4F60\u5C31\u53EF\u4EE5\u5F00\u59CB\u7F16\u5199 Hook \u4EE3\u7801\u4E86\uFF0C\u65B9\u5F0F\u4E0E\u4F5C\u4E3A Xposed \u6A21\u5757\u4F7F\u7528\u57FA\u672C\u4E00\u81F4\u3002</p><p>\u6709\u5173\u4F5C\u4E3A Hook API \u4F7F\u7528\u7684\u76F8\u5173\u914D\u7F6E\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u4F60\u53EF\u4EE5 <a href="../config/api-using">\u70B9\u51FB\u8FD9\u91CC</a> \u7EE7\u7EED\u9605\u8BFB\u3002</p><div class="custom-container warning"><p class="custom-container-title">\u6CE8\u610F</p><p>\u4F7F\u7528\u81EA\u5B9A\u4E49\u7684 Hook Framework \u800C\u5E76\u975E\u5B8C\u6574\u7684 Xposed \u6A21\u5757\u65F6\uFF0C<strong>YukiHookPrefsBridge</strong>\u3001<strong>YukiHookDataChannel</strong> \u4EE5\u53CA Resources Hook \u529F\u80FD\u5C06\u5931\u6548\u3002</p></div>`,27);function C(h,g){const e=o("ExternalLinkIcon");return p(),i("div",null,[t,n("p",null,[d,u,A,n("a",v,[y,c(e)]),m,b,D]),B])}const F=l(r,[["render",C],["__file","quick-start.html.vue"]]);export{F as default};
