import{_ as l,r as p,o as c,c as i,b as s,d as n,e,a as o}from"./app-BpUB8-Q8.js";const r={},t=o(`

作为 Hook API 使用的相关配置

作为 Hook API 通常为做自身 APP 热更新或功能需要以及产品测试的 Hook 操作。

依赖配置

你只需要集成 com.highcapable.yukihookapi:api 依赖即可。

然后请集成你目标使用的 Hook Framework 依赖。

入口配置

创建你的自定义 Application

attachBaseContext 中添加 YukiHookAPI.encase 方法。

示例如下

class MyApplication : Application() {

    override fun attachBaseContext(base: Context?) {
        // 装载 Hook Framework
        //
        // Your code here.
        //
        // 配置 YukiHookAPI
        YukiHookApi.configs {
            // Your code here.
        }
        // 装载 YukiHookAPI
        YukiHookAPI.encase(base) {
            // Your code here.
        }
        super.attachBaseContext(base)
    }
}

这样,你就完成了 API 的相关配置。

你可以 点击这里 查看异同点和注意事项。

注意

你不能再使用 loadApp 进行包装,可直接开始编写你的 Hook 代码。

Hook Framework

这里给出了一些较高使用率的 Hook Framework 如何对接 YukiHookAPI 的相关方式。

`,15),d={id:"pine",tabindex:"-1"},A=s("a",{class:"header-anchor",href:"#pine","aria-hidden":"true"},"#",-1),y={href:"https://github.com/canyie/pine",target:"_blank",rel:"noopener noreferrer"},u=o(`

所需 Xposed API 依赖 top.canyie.pine:xposed

示例如下

override fun attachBaseContext(base: Context?) {
    // 装载 Pine
    PineConfig.debug = true
    PineConfig.debuggable = BuildConfig.DEBUG
    // 装载 YukiHookAPI
    YukiHookAPI.encase(base) {
        // Your code here.
    }
    super.attachBaseContext(base)
}
`,3),B={id:"sandhook",tabindex:"-1"},C=s("a",{class:"header-anchor",href:"#sandhook","aria-hidden":"true"},"#",-1),b={href:"https://github.com/asLody/SandHook",target:"_blank",rel:"noopener noreferrer"},v=o(`

所需 Xposed API 依赖 com.swift.sandhook:xposedcompatcom.swift.sandhook:xposedcompat_new

示例如下

override fun attachBaseContext(base: Context?) {
    // 装载 SandHook
    SandHookConfig.DEBUG = BuildConfig.DEBUG
    XposedCompat.cacheDir = base?.cacheDir
    XposedCompat.context = base
    XposedCompat.classLoader = javaClass.classLoader
    XposedCompat.isFirstApplication = base?.processName == base?.packageName
    // 装载 YukiHookAPI
    YukiHookAPI.encase(base) {
        // Your code here.
    }
    super.attachBaseContext(base)
}
`,3),D={id:"whale",tabindex:"-1"},h=s("a",{class:"header-anchor",href:"#whale","aria-hidden":"true"},"#",-1),m={href:"https://github.com/asLody/whale",target:"_blank",rel:"noopener noreferrer"},k=s("blockquote",null,[s("p",null,[s("strong",null,"所需 Xposed API 依赖"),n(),s("code",null,"com.wind.xposed:xposed-on-whale")])],-1),F={href:"https://github.com/WindySha/xposed-hook-based-on-whale",target:"_blank",rel:"noopener noreferrer"},_=o(`

示例如下

override fun attachBaseContext(base: Context?) {
    // 装载 Whale 不需要任何配置
    // 装载 YukiHookAPI
    YukiHookAPI.encase(base) {
        // Your code here.
    }
    super.attachBaseContext(base)
}
`,2);function g(x,f){const a=p("ExternalLinkIcon");return c(),i("div",null,[t,s("h3",d,[A,n(),s("a",y,[n("Pine"),e(a)])]),u,s("h3",B,[C,n(),s("a",b,[n("SandHook"),e(a)])]),v,s("h3",D,[h,n(),s("a",m,[n("Whale"),e(a)])]),k,s("p",null,[n("请参考 "),s("a",F,[n("xposed-hook-based-on-whale"),e(a)]),n("。")]),_])}const P=l(r,[["render",g],["__file","api-using.html.vue"]]);export{P as default};