Files
YukiHookAPI/docs/en/guide/example.html

319 lines
124 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="VuePress 2.0.0-beta.51">
<style>
:root {
--c-bg: #fff;
}
html.dark {
--c-bg: #22272e;
}
html, body {
background-color: var(--c-bg);
}
</style>
<script>
const userMode = localStorage.getItem('vuepress-color-scheme');
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
document.documentElement.classList.toggle('dark', true);
}
</script>
<link rel="icon" href="/images/logo.png"><title>Usage Example | Yuki Hook API</title><meta name="description" content="An efficient Kotlin version of the Xposed Hook API">
<link rel="modulepreload" href="/YukiHookAPI/assets/app.fb8271cf.js"><link rel="modulepreload" href="/YukiHookAPI/assets/example.html.e66bd85b.js"><link rel="modulepreload" href="/YukiHookAPI/assets/example.html.a036bda1.js"><link rel="prefetch" href="/YukiHookAPI/assets/index.html.1b76ac9e.js"><link rel="prefetch" href="/YukiHookAPI/assets/index.html.872aa7a1.js"><link rel="prefetch" href="/YukiHookAPI/assets/index.html.6cc32291.js"><link rel="prefetch" href="/YukiHookAPI/assets/about.html.7638d3a2.js"><link rel="prefetch" href="/YukiHookAPI/assets/changelog.html.86d916d5.js"><link rel="prefetch" href="/YukiHookAPI/assets/contacts.html.5dc8225c.js"><link rel="prefetch" href="/YukiHookAPI/assets/future.html.94bd226b.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.f6b9c2a4.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-example.html.47c311e0.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-exception.html.72ebad13.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-using.html.c794f69e.js"><link rel="prefetch" href="/YukiHookAPI/assets/r8-proguard.html.15e04e11.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-using.html.cd65195d.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.f6f658d0.js"><link rel="prefetch" href="/YukiHookAPI/assets/knowledge.html.437816ed.js"><link rel="prefetch" href="/YukiHookAPI/assets/move-to-new-api.html.78f39fa5.js"><link rel="prefetch" href="/YukiHookAPI/assets/quick-start.html.e309979a.js"><link rel="prefetch" href="/YukiHookAPI/assets/yukihookapi-projectbuilder.html.ed4fa356.js"><link rel="prefetch" href="/YukiHookAPI/assets/about.html.c0115524.js"><link rel="prefetch" href="/YukiHookAPI/assets/changelog.html.05a4745e.js"><link rel="prefetch" href="/YukiHookAPI/assets/contacts.html.3df7cacf.js"><link rel="prefetch" href="/YukiHookAPI/assets/future.html.2cf8d6de.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.cad3998c.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-example.html.f5361b1b.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-exception.html.ac2a5859.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-using.html.0a59e2e0.js"><link rel="prefetch" href="/YukiHookAPI/assets/r8-proguard.html.683a5429.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-using.html.557dcdf1.js"><link rel="prefetch" href="/YukiHookAPI/assets/example.html.13ac887a.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.4d8cac8a.js"><link rel="prefetch" href="/YukiHookAPI/assets/knowledge.html.821f04b5.js"><link rel="prefetch" href="/YukiHookAPI/assets/move-to-new-api.html.508c5312.js"><link rel="prefetch" href="/YukiHookAPI/assets/quick-start.html.eacb83f2.js"><link rel="prefetch" href="/YukiHookAPI/assets/yukihookapi-projectbuilder.html.d499d226.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-inject.html.c5fc5faf.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-lifecycle.html.412bbdd6.js"><link rel="prefetch" href="/YukiHookAPI/assets/logger.html.2d57680b.js"><link rel="prefetch" href="/YukiHookAPI/assets/reflection.html.ff24950f.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-channel.html.96712a39.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-storage.html.c35a7041.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-inject.html.83f072dc.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-lifecycle.html.09c0b222.js"><link rel="prefetch" href="/YukiHookAPI/assets/logger.html.e8fab6a3.js"><link rel="prefetch" href="/YukiHookAPI/assets/reflection.html.2e612549.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-channel.html.b798a8f8.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-storage.html.5fd9a913.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookAPI.html.77b2a461.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookAPI.html.476693ca.js"><link rel="prefetch" href="/YukiHookAPI/assets/InjectYukiHookWithXposed.html.56391530.js"><link rel="prefetch" href="/YukiHookAPI/assets/CurrentClass.html.16c29272.js"><link rel="prefetch" href="/YukiHookAPI/assets/GenericClass.html.7b666428.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookClass.html.52e59cf0.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookResources.html.2486cf29.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariousClass.html.bd237fa4.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiMemberHookCreator.html.d3b181da.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResourcesHookCreator.html.8aaa9934.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiBaseHooker.html.99eec744.js"><link rel="prefetch" href="/YukiHookAPI/assets/ReflectionFactory.html.a9e6e2d7.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookFactory.html.61db5860.js"><link rel="prefetch" href="/YukiHookAPI/assets/LoggerFactory.html.914e1c34.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookParam.html.b19d4ad2.js"><link rel="prefetch" href="/YukiHookAPI/assets/PackageParam.html.7a64d58c.js"><link rel="prefetch" href="/YukiHookAPI/assets/CurrentClass.html.641fcd58.js"><link rel="prefetch" href="/YukiHookAPI/assets/GenericClass.html.3a0e1ac6.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookClass.html.486aa6ea.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookResources.html.4f07fd98.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariousClass.html.7c81aa10.js"><link rel="prefetch" href="/YukiHookAPI/assets/InjectYukiHookWithXposed.html.cf9b500d.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiMemberHookCreator.html.37dcaec4.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResourcesHookCreator.html.46168b72.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiBaseHooker.html.b68236f9.js"><link rel="prefetch" href="/YukiHookAPI/assets/ReflectionFactory.html.f7b7c82c.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookFactory.html.64f654a6.js"><link rel="prefetch" href="/YukiHookAPI/assets/LoggerFactory.html.72d1861a.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookParam.html.f98d02d2.js"><link rel="prefetch" href="/YukiHookAPI/assets/PackageParam.html.37aae471.js"><link rel="prefetch" href="/YukiHookAPI/assets/ComponentTypeFactory.html.5af05d7d.js"><link rel="prefetch" href="/YukiHookAPI/assets/GraphicsTypeFactory.html.a3936b7c.js"><link rel="prefetch" href="/YukiHookAPI/assets/ViewTypeFactory.html.7da3eef4.js"><link rel="prefetch" href="/YukiHookAPI/assets/DefinedTypeFactory.html.8137c32c.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariableTypeFactory.html.d4c9dbd1.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleApplication.html.57573770.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookDataChannel.html.75c012dd.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookModulePrefs.html.e0f278fe.js"><link rel="prefetch" href="/YukiHookAPI/assets/IYukiHookXposedInit.html.b37a852b.js"><link rel="prefetch" href="/YukiHookAPI/assets/ComponentTypeFactory.html.0026a7b8.js"><link rel="prefetch" href="/YukiHookAPI/assets/GraphicsTypeFactory.html.bfb4e259.js"><link rel="prefetch" href="/YukiHookAPI/assets/ViewTypeFactory.html.612b6202.js"><link rel="prefetch" href="/YukiHookAPI/assets/DefinedTypeFactory.html.ba3bdd0b.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariableTypeFactory.html.550d3346.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleApplication.html.a386b8db.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookDataChannel.html.74e08a45.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookModulePrefs.html.5eb62ec3.js"><link rel="prefetch" href="/YukiHookAPI/assets/IYukiHookXposedInit.html.78a55860.js"><link rel="prefetch" href="/YukiHookAPI/assets/BaseFinder.html.a5dbb7a7.js"><link rel="prefetch" href="/YukiHookAPI/assets/DexClassFinder.html.5d8e12f0.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorFinder.html.0c13dc47.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldFinder.html.4410e26c.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodFinder.html.97f89f93.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiModuleResources.html.e5c5fb30.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResForwarder.html.4e23df75.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResources.html.afb6fb92.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiXposedEvent.html.560fa41c.js"><link rel="prefetch" href="/YukiHookAPI/assets/ChannelData.html.f8f818f6.js"><link rel="prefetch" href="/YukiHookAPI/assets/PrefsData.html.dfd7c23c.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModulePreferenceFragment.html.764fecc3.js"><link rel="prefetch" href="/YukiHookAPI/assets/BaseFinder.html.8f275c85.js"><link rel="prefetch" href="/YukiHookAPI/assets/DexClassFinder.html.78c5f805.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorFinder.html.7de4f560.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldFinder.html.25713065.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodFinder.html.03ce70ab.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiModuleResources.html.d8e27a7f.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResForwarder.html.0dadd8db.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResources.html.7b0a4824.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiXposedEvent.html.a93ee4ef.js"><link rel="prefetch" href="/YukiHookAPI/assets/ChannelData.html.194718a1.js"><link rel="prefetch" href="/YukiHookAPI/assets/PrefsData.html.d3cf97f9.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModulePreferenceFragment.html.0c7dadc7.js"><link rel="prefetch" href="/YukiHookAPI/assets/CountRules.html.2d5ab94d.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModifierRules.html.c36dff17.js"><link rel="prefetch" href="/YukiHookAPI/assets/NameRules.html.00ac96fb.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorRules.html.d62bae6c.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldRules.html.9b04521f.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRules.html.a071b3c6.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodRules.html.c10f9770.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppActivity.html.90d3c4e6.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppCompatActivity.html.a20d9206.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleContextThemeWrapper.html.0879426b.js"><link rel="prefetch" href="/YukiHookAPI/assets/CountRules.html.2639d392.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModifierRules.html.f7582dc2.js"><link rel="prefetch" href="/YukiHookAPI/assets/NameRules.html.47e512e4.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorRules.html.f8d7dd83.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldRules.html.6858f0d6.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRules.html.b3e5d297.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodRules.html.146b27be.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleContextThemeWrapper.html.229a46ac.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppActivity.html.09451ff7.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppCompatActivity.html.dd9e40e9.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRulesResult.html.e79843c3.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRulesResult.html.58e81c94.js"><link rel="prefetch" href="/YukiHookAPI/assets/404.html.c038a05a.js"><link rel="prefetch" href="/YukiHookAPI/assets/index.html.f53b6095.js"><link rel="prefetch" href="/YukiHookAPI/assets/index.html.d735d08d.js"><link rel="prefetch" href="/YukiHookAPI/assets/index.html.f36dcd2e.js"><link rel="prefetch" href="/YukiHookAPI/assets/about.html.7d8b24a5.js"><link rel="prefetch" href="/YukiHookAPI/assets/changelog.html.22a53013.js"><link rel="prefetch" href="/YukiHookAPI/assets/contacts.html.8946c067.js"><link rel="prefetch" href="/YukiHookAPI/assets/future.html.e52259cf.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.fd8a27c6.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-example.html.ffabf490.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-exception.html.5fb01524.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-using.html.1ec848ab.js"><link rel="prefetch" href="/YukiHookAPI/assets/r8-proguard.html.1ec215bf.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-using.html.f07fa93e.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.6cc8b4b8.js"><link rel="prefetch" href="/YukiHookAPI/assets/knowledge.html.a4616f5c.js"><link rel="prefetch" href="/YukiHookAPI/assets/move-to-new-api.html.f0cc4092.js"><link rel="prefetch" href="/YukiHookAPI/assets/quick-start.html.749cf17e.js"><link rel="prefetch" href="/YukiHookAPI/assets/yukihookapi-projectbuilder.html.c5d87cd3.js"><link rel="prefetch" href="/YukiHookAPI/assets/about.html.f4c8582a.js"><link rel="prefetch" href="/YukiHookAPI/assets/changelog.html.576ee237.js"><link rel="prefetch" href="/YukiHookAPI/assets/contacts.html.0e0a7262.js"><link rel="prefetch" href="/YukiHookAPI/assets/future.html.4da05d23.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.e164d825.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-example.html.63409bed.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-exception.html.9f654113.js"><link rel="prefetch" href="/YukiHookAPI/assets/api-using.html.37eb156b.js"><link rel="prefetch" href="/YukiHookAPI/assets/r8-proguard.html.44d498ce.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-using.html.701123e9.js"><link rel="prefetch" href="/YukiHookAPI/assets/example.html.be2f529d.js"><link rel="prefetch" href="/YukiHookAPI/assets/home.html.06a0e41c.js"><link rel="prefetch" href="/YukiHookAPI/assets/knowledge.html.e0a069f9.js"><link rel="prefetch" href="/YukiHookAPI/assets/move-to-new-api.html.2d2ee2a7.js"><link rel="prefetch" href="/YukiHookAPI/assets/quick-start.html.20dd75c7.js"><link rel="prefetch" href="/YukiHookAPI/assets/yukihookapi-projectbuilder.html.ae5d1a49.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-inject.html.e5c6c6ae.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-lifecycle.html.73e3c8fc.js"><link rel="prefetch" href="/YukiHookAPI/assets/logger.html.55af0b09.js"><link rel="prefetch" href="/YukiHookAPI/assets/reflection.html.37e12a3d.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-channel.html.ea22e7ce.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-storage.html.cd1e83bb.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-inject.html.acabeb56.js"><link rel="prefetch" href="/YukiHookAPI/assets/host-lifecycle.html.56277eb5.js"><link rel="prefetch" href="/YukiHookAPI/assets/logger.html.fd07b1ad.js"><link rel="prefetch" href="/YukiHookAPI/assets/reflection.html.3174ec77.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-channel.html.18cd2bdb.js"><link rel="prefetch" href="/YukiHookAPI/assets/xposed-storage.html.6926bcf4.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookAPI.html.1c02f82e.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookAPI.html.18811dc9.js"><link rel="prefetch" href="/YukiHookAPI/assets/InjectYukiHookWithXposed.html.b6100747.js"><link rel="prefetch" href="/YukiHookAPI/assets/CurrentClass.html.072e89c6.js"><link rel="prefetch" href="/YukiHookAPI/assets/GenericClass.html.b1c03ed1.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookClass.html.f01a0415.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookResources.html.b888e8b6.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariousClass.html.3e45065c.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiMemberHookCreator.html.bacce7a8.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResourcesHookCreator.html.d14760e0.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiBaseHooker.html.0fb80f07.js"><link rel="prefetch" href="/YukiHookAPI/assets/ReflectionFactory.html.daab3686.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookFactory.html.61878d38.js"><link rel="prefetch" href="/YukiHookAPI/assets/LoggerFactory.html.84495d50.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookParam.html.918accc4.js"><link rel="prefetch" href="/YukiHookAPI/assets/PackageParam.html.3014d07d.js"><link rel="prefetch" href="/YukiHookAPI/assets/CurrentClass.html.2e606398.js"><link rel="prefetch" href="/YukiHookAPI/assets/GenericClass.html.ca958253.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookClass.html.7354fd95.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookResources.html.70a752b2.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariousClass.html.5a07233f.js"><link rel="prefetch" href="/YukiHookAPI/assets/InjectYukiHookWithXposed.html.ecb261b1.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiMemberHookCreator.html.55afd41d.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResourcesHookCreator.html.ddbc430b.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiBaseHooker.html.6b167698.js"><link rel="prefetch" href="/YukiHookAPI/assets/ReflectionFactory.html.d2629c75.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookFactory.html.122ae5d0.js"><link rel="prefetch" href="/YukiHookAPI/assets/LoggerFactory.html.bb211a96.js"><link rel="prefetch" href="/YukiHookAPI/assets/HookParam.html.30f4fb72.js"><link rel="prefetch" href="/YukiHookAPI/assets/PackageParam.html.4c3306f9.js"><link rel="prefetch" href="/YukiHookAPI/assets/ComponentTypeFactory.html.61d8989e.js"><link rel="prefetch" href="/YukiHookAPI/assets/GraphicsTypeFactory.html.61eca533.js"><link rel="prefetch" href="/YukiHookAPI/assets/ViewTypeFactory.html.e29c5d7e.js"><link rel="prefetch" href="/YukiHookAPI/assets/DefinedTypeFactory.html.bca7fe3f.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariableTypeFactory.html.6d08103b.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleApplication.html.e946b5fe.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookDataChannel.html.f40252bf.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookModulePrefs.html.77ac932a.js"><link rel="prefetch" href="/YukiHookAPI/assets/IYukiHookXposedInit.html.7f3e0a05.js"><link rel="prefetch" href="/YukiHookAPI/assets/ComponentTypeFactory.html.2f6bbc66.js"><link rel="prefetch" href="/YukiHookAPI/assets/GraphicsTypeFactory.html.df9b6853.js"><link rel="prefetch" href="/YukiHookAPI/assets/ViewTypeFactory.html.f12c489b.js"><link rel="prefetch" href="/YukiHookAPI/assets/DefinedTypeFactory.html.1a27d470.js"><link rel="prefetch" href="/YukiHookAPI/assets/VariableTypeFactory.html.c8d4e99d.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleApplication.html.ad43cded.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookDataChannel.html.b01666c1.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiHookModulePrefs.html.9506520f.js"><link rel="prefetch" href="/YukiHookAPI/assets/IYukiHookXposedInit.html.4813ba4f.js"><link rel="prefetch" href="/YukiHookAPI/assets/BaseFinder.html.8588c8ac.js"><link rel="prefetch" href="/YukiHookAPI/assets/DexClassFinder.html.5e274913.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorFinder.html.022babd4.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldFinder.html.7f3e47fc.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodFinder.html.55746f01.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiModuleResources.html.581abd4c.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResForwarder.html.3fa53afd.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResources.html.b3a31d94.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiXposedEvent.html.ae210e6f.js"><link rel="prefetch" href="/YukiHookAPI/assets/ChannelData.html.2358cb0e.js"><link rel="prefetch" href="/YukiHookAPI/assets/PrefsData.html.be01fa30.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModulePreferenceFragment.html.40d2af95.js"><link rel="prefetch" href="/YukiHookAPI/assets/BaseFinder.html.1ec4ffab.js"><link rel="prefetch" href="/YukiHookAPI/assets/DexClassFinder.html.92677d64.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorFinder.html.254da89b.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldFinder.html.908d5caa.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodFinder.html.9844b141.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiModuleResources.html.c36ad6ed.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResForwarder.html.ef96ef7b.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiResources.html.d71b960b.js"><link rel="prefetch" href="/YukiHookAPI/assets/YukiXposedEvent.html.e00ead3e.js"><link rel="prefetch" href="/YukiHookAPI/assets/ChannelData.html.2404edfd.js"><link rel="prefetch" href="/YukiHookAPI/assets/PrefsData.html.0d8e9948.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModulePreferenceFragment.html.7e33a328.js"><link rel="prefetch" href="/YukiHookAPI/assets/CountRules.html.52ed8a0d.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModifierRules.html.1596e901.js"><link rel="prefetch" href="/YukiHookAPI/assets/NameRules.html.5da95c04.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorRules.html.d56dfdf4.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldRules.html.990238ad.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRules.html.1a50f297.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodRules.html.b1f90f61.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppActivity.html.1aa71ae6.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppCompatActivity.html.2fd9ae3a.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleContextThemeWrapper.html.5787cac6.js"><link rel="prefetch" href="/YukiHookAPI/assets/CountRules.html.5103015c.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModifierRules.html.4767495f.js"><link rel="prefetch" href="/YukiHookAPI/assets/NameRules.html.4729f5e5.js"><link rel="prefetch" href="/YukiHookAPI/assets/ConstructorRules.html.e17434ce.js"><link rel="prefetch" href="/YukiHookAPI/assets/FieldRules.html.1fea86e8.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRules.html.fbc5b06f.js"><link rel="prefetch" href="/YukiHookAPI/assets/MethodRules.html.9819df7e.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleContextThemeWrapper.html.7262b83c.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppActivity.html.fd7c57b2.js"><link rel="prefetch" href="/YukiHookAPI/assets/ModuleAppCompatActivity.html.de402219.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRulesResult.html.2524371e.js"><link rel="prefetch" href="/YukiHookAPI/assets/MemberRulesResult.html.49b372bb.js"><link rel="prefetch" href="/YukiHookAPI/assets/404.html.d9151b86.js">
<link rel="stylesheet" href="/YukiHookAPI/assets/style.e115708c.css">
</head>
<body>
<div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/YukiHookAPI/en/" class=""><img class="logo" src="/YukiHookAPI/images/logo.png" alt="Yuki Hook API"><span class="site-name can-hide">Yuki Hook API</span></a></span><div class="navbar-items-wrapper" style=""><!--[--><!--]--><nav class="navbar-items can-hide"><!--[--><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Get Started</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/home" class="" aria-label="Introduce"><!--[--><!--]--> Introduce <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/knowledge" class="" aria-label="Basic Knowledge"><!--[--><!--]--> Basic Knowledge <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/quick-start" class="" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/example" class="router-link-active" aria-label="Usage Example"><!--[--><!--]--> Usage Example <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/move-to-new-api" class="" aria-label="Migrate from Xposed API"><!--[--><!--]--> Migrate from Xposed API <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Configs</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/api-example" class="" aria-label="API Basic Configs"><!--[--><!--]--> API Basic Configs <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/api-exception" class="" aria-label="API Exception Handling"><!--[--><!--]--> API Exception Handling <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/xposed-using" class="" aria-label="Use as Xposed Module Configs"><!--[--><!--]--> Use as Xposed Module Configs <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/api-using" class="" aria-label="Use as Hook API Configs"><!--[--><!--]--> Use as Hook API Configs <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/r8-proguard" class="" aria-label="R8 &amp; Proguard Obfuscate"><!--[--><!--]--> R8 &amp; Proguard Obfuscate <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Tools</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/tools/yukihookapi-projectbuilder" class="" aria-label="YukiHookAPI Project Builder"><!--[--><!--]--> YukiHookAPI Project Builder <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>API Document</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/api/home" class="" aria-label="Document Introduction"><!--[--><!--]--> Document Introduction <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/YukiHookAPI" class="" aria-label="Public API"><!--[--><!--]--> Public API <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/api/special-features/reflection" class="" aria-label="Special Features"><!--[--><!--]--> Special Features <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>About</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/changelog" class="" aria-label="Changelog"><!--[--><!--]--> Changelog <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/future" class="" aria-label="Looking for Future"><!--[--><!--]--> Looking for Future <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/contacts" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/about" class="" aria-label="About this Document"><!--[--><!--]--> About this Document <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul></div></div><div class="navbar-item"><a href="/YukiHookAPI/en/about/contacts" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a aria-current="page" href="/YukiHookAPI/en/guide/example.html" class="router-link-active router-link-exact-active router-link-active" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a href="/YukiHookAPI/zh-cn/guide/example.html" class="" aria-label="简体中文"><!--[--><!--]--> 简体中文 <!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/fankes/YukiHookAPI" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-color-mode-button" title="toggle color mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><form class="search-box" role="search"><input type="search" placeholder="Search" autocomplete="off" spellcheck="false" value><!----></form></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-items"><!--[--><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Navigation"><span class="title">Navigation</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Get Started</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/home" class="" aria-label="Introduce"><!--[--><!--]--> Introduce <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/knowledge" class="" aria-label="Basic Knowledge"><!--[--><!--]--> Basic Knowledge <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/quick-start" class="" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/example" class="router-link-active" aria-label="Usage Example"><!--[--><!--]--> Usage Example <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/guide/move-to-new-api" class="" aria-label="Migrate from Xposed API"><!--[--><!--]--> Migrate from Xposed API <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Configs</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/api-example" class="" aria-label="API Basic Configs"><!--[--><!--]--> API Basic Configs <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/api-exception" class="" aria-label="API Exception Handling"><!--[--><!--]--> API Exception Handling <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/xposed-using" class="" aria-label="Use as Xposed Module Configs"><!--[--><!--]--> Use as Xposed Module Configs <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/api-using" class="" aria-label="Use as Hook API Configs"><!--[--><!--]--> Use as Hook API Configs <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/config/r8-proguard" class="" aria-label="R8 &amp; Proguard Obfuscate"><!--[--><!--]--> R8 &amp; Proguard Obfuscate <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>Tools</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/tools/yukihookapi-projectbuilder" class="" aria-label="YukiHookAPI Project Builder"><!--[--><!--]--> YukiHookAPI Project Builder <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>API Document</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/api/home" class="" aria-label="Document Introduction"><!--[--><!--]--> Document Introduction <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/YukiHookAPI" class="" aria-label="Public API"><!--[--><!--]--> Public API <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/api/special-features/reflection" class="" aria-label="Special Features"><!--[--><!--]--> Special Features <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>About</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/changelog" class="" aria-label="Changelog"><!--[--><!--]--> Changelog <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/future" class="" aria-label="Looking for Future"><!--[--><!--]--> Looking for Future <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/contacts" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/YukiHookAPI/en/about/about" class="" aria-label="About this Document"><!--[--><!--]--> About this Document <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul></div></div><div class="navbar-item"><a href="/YukiHookAPI/en/about/contacts" class="" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">English (US)</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a aria-current="page" href="/YukiHookAPI/en/guide/example.html" class="router-link-active router-link-exact-active router-link-active" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a href="/YukiHookAPI/zh-cn/guide/example.html" class="" aria-label="简体中文"><!--[--><!--]--> 简体中文 <!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/fankes/YukiHookAPI" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-items"><!--[--><li><p tabindex="0" class="sidebar-item sidebar-heading active collapsible">Get Started <span class="down arrow"></span></p><ul style="" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/guide/home.html" class="sidebar-item" aria-label="Introduce"><!--[--><!--]--> Introduce <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/guide/knowledge.html" class="sidebar-item" aria-label="Basic Knowledge"><!--[--><!--]--> Basic Knowledge <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/guide/quick-start.html" class="sidebar-item" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html" class="router-link-active router-link-exact-active router-link-active sidebar-item active" aria-label="Usage Example"><!--[--><!--]--> Usage Example <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#structure-diagram" class="router-link-active router-link-exact-active sidebar-item" aria-label="Structure Diagram"><!--[--><!--]--> Structure Diagram <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#demo" class="router-link-active router-link-exact-active sidebar-item" aria-label="Demo"><!--[--><!--]--> Demo <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#a-simple-hook-example" class="router-link-active router-link-exact-active sidebar-item" aria-label="A Simple Hook Example"><!--[--><!--]--> A Simple Hook Example <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#hook-app" class="router-link-active router-link-exact-active sidebar-item" aria-label="Hook App"><!--[--><!--]--> Hook App <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#hook-zygote" class="router-link-active router-link-exact-active sidebar-item" aria-label="Hook Zygote"><!--[--><!--]--> Hook Zygote <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#hook-system-framework" class="router-link-active router-link-exact-active sidebar-item" aria-label="Hook System Framework"><!--[--><!--]--> Hook System Framework <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#hook-resources" class="router-link-active router-link-exact-active sidebar-item" aria-label="Hook Resources"><!--[--><!--]--> Hook Resources <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#remove-hook" class="router-link-active router-link-exact-active sidebar-item" aria-label="Remove Hook"><!--[--><!--]--> Remove Hook <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#exception-handling" class="router-link-active router-link-exact-active sidebar-item" aria-label="Exception Handling"><!--[--><!--]--> Exception Handling <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#listen-for-exceptions" class="router-link-active router-link-exact-active sidebar-item" aria-label="Listen for Exceptions"><!--[--><!--]--> Listen for Exceptions <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#throw-an-exception" class="router-link-active router-link-exact-active sidebar-item" aria-label="Throw an Exception"><!--[--><!--]--> Throw an Exception <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#status-monitor" class="router-link-active router-link-exact-active sidebar-item" aria-label="Status Monitor"><!--[--><!--]--> Status Monitor <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#expansion-usage" class="router-link-active router-link-exact-active sidebar-item" aria-label="Expansion Usage"><!--[--><!--]--> Expansion Usage <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#multiple-hosts" class="router-link-active router-link-exact-active sidebar-item" aria-label="Multiple Hosts"><!--[--><!--]--> Multiple Hosts <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#multiple-processes" class="router-link-active router-link-exact-active sidebar-item" aria-label="Multiple Processes"><!--[--><!--]--> Multiple Processes <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#writing-optimization" class="router-link-active router-link-exact-active sidebar-item" aria-label="Writing Optimization"><!--[--><!--]--> Writing Optimization <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/YukiHookAPI/en/guide/example.html#xposed-module-own-active-state" class="router-link-active router-link-exact-active sidebar-item" aria-label="Xposed Module own Active State"><!--[--><!--]--> Xposed Module own Active State <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a href="/YukiHookAPI/en/guide/move-to-new-api.html" class="sidebar-item" aria-label="Migrate from Xposed API"><!--[--><!--]--> Migrate from Xposed API <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Configs <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/config/api-example.html" class="sidebar-item" aria-label="API Basic Configs"><!--[--><!--]--> API Basic Configs <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/config/api-exception.html" class="sidebar-item" aria-label="API Exception Handling"><!--[--><!--]--> API Exception Handling <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/config/xposed-using.html" class="sidebar-item" aria-label="Use as Xposed Module Configs"><!--[--><!--]--> Use as Xposed Module Configs <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/config/api-using.html" class="sidebar-item" aria-label="Use as Hook API Configs"><!--[--><!--]--> Use as Hook API Configs <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/config/r8-proguard.html" class="sidebar-item" aria-label="R8 &amp; Proguard Obfuscate"><!--[--><!--]--> R8 &amp; Proguard Obfuscate <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">Tools <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/tools/yukihookapi-projectbuilder.html" class="sidebar-item" aria-label="YukiHookAPI Project Builder"><!--[--><!--]--> YukiHookAPI Project Builder <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">API Document <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/api/home.html" class="sidebar-item" aria-label="Document Introduce"><!--[--><!--]--> Document Introduce <!--[--><!--]--></a><!----></li><li><p tabindex="0" class="sidebar-item collapsible">Public API  <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/YukiHookAPI.html" class="sidebar-item" aria-label="YukiHookAPI - object"><!--[--><!--]--> YukiHookAPI - object <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/param/PackageParam.html" class="sidebar-item" aria-label="PackageParam - class"><!--[--><!--]--> PackageParam - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/param/HookParam.html" class="sidebar-item" aria-label="HookParam - class"><!--[--><!--]--> HookParam - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.html" class="sidebar-item" aria-label="InjectYukiHookWithXposed - annotation"><!--[--><!--]--> InjectYukiHookWithXposed - annotation <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.html" class="sidebar-item" aria-label="IYukiHookXposedInit - interface"><!--[--><!--]--> IYukiHookXposedInit - interface <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs.html" class="sidebar-item" aria-label="YukiHookModulePrefs - class"><!--[--><!--]--> YukiHookModulePrefs - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.html" class="sidebar-item" aria-label="ModulePreferenceFragment - class"><!--[--><!--]--> ModulePreferenceFragment - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.html" class="sidebar-item" aria-label="PrefsData - class"><!--[--><!--]--> PrefsData - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.html" class="sidebar-item" aria-label="YukiHookDataChannel - class"><!--[--><!--]--> YukiHookDataChannel - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.html" class="sidebar-item" aria-label="ChannelData - class"><!--[--><!--]--> ChannelData - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.html" class="sidebar-item" aria-label="ModuleApplication - class"><!--[--><!--]--> ModuleApplication - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.html" class="sidebar-item" aria-label="ModuleAppActivity - class"><!--[--><!--]--> ModuleAppActivity - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.html" class="sidebar-item" aria-label="ModuleAppCompatActivity - class"><!--[--><!--]--> ModuleAppCompatActivity - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.html" class="sidebar-item" aria-label="ModuleContextThemeWrapper - class"><!--[--><!--]--> ModuleContextThemeWrapper - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiModuleResources.html" class="sidebar-item" aria-label="YukiModuleResources - class"><!--[--><!--]--> YukiModuleResources - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResources.html" class="sidebar-item" aria-label="YukiResources - class"><!--[--><!--]--> YukiResources - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/dummy/YukiResForwarder.html" class="sidebar-item" aria-label="YukiResForwarder - class"><!--[--><!--]--> YukiResForwarder - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.html" class="sidebar-item" aria-label="YukiXposedEvent - object"><!--[--><!--]--> YukiXposedEvent - object <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.html" class="sidebar-item" aria-label="ComponentTypeFactory - kt"><!--[--><!--]--> ComponentTypeFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.html" class="sidebar-item" aria-label="GraphicsTypeFactory - kt"><!--[--><!--]--> GraphicsTypeFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.html" class="sidebar-item" aria-label="ViewTypeFactory - kt"><!--[--><!--]--> ViewTypeFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.html" class="sidebar-item" aria-label="VariableTypeFactory - kt"><!--[--><!--]--> VariableTypeFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.html" class="sidebar-item" aria-label="DefinedTypeFactory - kt"><!--[--><!--]--> DefinedTypeFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/log/LoggerFactory.html" class="sidebar-item" aria-label="LoggerFactory - kt"><!--[--><!--]--> LoggerFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.html" class="sidebar-item" aria-label="ReflectionFactory - kt"><!--[--><!--]--> ReflectionFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.html" class="sidebar-item" aria-label="YukiHookFactory - kt"><!--[--><!--]--> YukiHookFactory - kt <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.html" class="sidebar-item" aria-label="YukiBaseHooker - class"><!--[--><!--]--> YukiBaseHooker - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.html" class="sidebar-item" aria-label="YukiMemberHookCreator - class"><!--[--><!--]--> YukiMemberHookCreator - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.html" class="sidebar-item" aria-label="YukiResourcesHookCreator - class"><!--[--><!--]--> YukiResourcesHookCreator - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.html" class="sidebar-item" aria-label="MethodFinder - class"><!--[--><!--]--> MethodFinder - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.html" class="sidebar-item" aria-label="ConstructorFinder - class"><!--[--><!--]--> ConstructorFinder - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.html" class="sidebar-item" aria-label="FieldFinder - class"><!--[--><!--]--> FieldFinder - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.html" class="sidebar-item" aria-label="DexClassFinder - class"><!--[--><!--]--> DexClassFinder - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.html" class="sidebar-item" aria-label="MemberRulesResult - class"><!--[--><!--]--> MemberRulesResult - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.html" class="sidebar-item" aria-label="MemberRules - class"><!--[--><!--]--> MemberRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.html" class="sidebar-item" aria-label="FieldRules - class"><!--[--><!--]--> FieldRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.html" class="sidebar-item" aria-label="MethodRules - class"><!--[--><!--]--> MethodRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.html" class="sidebar-item" aria-label="ConstructorRules - class"><!--[--><!--]--> ConstructorRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.html" class="sidebar-item" aria-label="BaseFinder - class"><!--[--><!--]--> BaseFinder - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.html" class="sidebar-item" aria-label="CountRules - class"><!--[--><!--]--> CountRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.html" class="sidebar-item" aria-label="ModifierRules - class"><!--[--><!--]--> ModifierRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.html" class="sidebar-item" aria-label="NameRules - class"><!--[--><!--]--> NameRules - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/bean/HookClass.html" class="sidebar-item" aria-label="HookClass - class"><!--[--><!--]--> HookClass - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/bean/VariousClass.html" class="sidebar-item" aria-label="VariousClass - class"><!--[--><!--]--> VariousClass - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/bean/CurrentClass.html" class="sidebar-item" aria-label="CurrentClass - class"><!--[--><!--]--> CurrentClass - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/bean/GenericClass.html" class="sidebar-item" aria-label="GenericClass - class"><!--[--><!--]--> GenericClass - class <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/public/com/highcapable/yukihookapi/hook/bean/HookResources.html" class="sidebar-item" aria-label="HookResources - class"><!--[--><!--]--> HookResources - class <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item collapsible">Special Features  <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/api/special-features/reflection.html" class="sidebar-item" aria-label="Reflection Extensions"><!--[--><!--]--> Reflection Extensions <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/special-features/logger.html" class="sidebar-item" aria-label="Debug Logs"><!--[--><!--]--> Debug Logs <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/special-features/xposed-storage.html" class="sidebar-item" aria-label="Xposed Module Data Storage"><!--[--><!--]--> Xposed Module Data Storage <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/special-features/xposed-channel.html" class="sidebar-item" aria-label="Xposed Module and Host Channel"><!--[--><!--]--> Xposed Module and Host Channel <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/special-features/host-lifecycle.html" class="sidebar-item" aria-label="Host Lifecycle Extension"><!--[--><!--]--> Host Lifecycle Extension <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/api/special-features/host-inject.html" class="sidebar-item" aria-label="Host Resource Injection Extension"><!--[--><!--]--> Host Resource Injection Extension <!--[--><!--]--></a><!----></li><!--]--></ul></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">About <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/YukiHookAPI/en/about/changelog.html" class="sidebar-item" aria-label="Changelog"><!--[--><!--]--> Changelog <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/about/future.html" class="sidebar-item" aria-label="Looking for Future"><!--[--><!--]--> Looking for Future <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/about/contacts.html" class="sidebar-item" aria-label="Contact Us"><!--[--><!--]--> Contact Us <!--[--><!--]--></a><!----></li><li><a href="/YukiHookAPI/en/about/about.html" class="sidebar-item" aria-label="About this Document"><!--[--><!--]--> About this Document <!--[--><!--]--></a><!----></li><!--]--></ul></li><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><!--]--><div><h1 id="usage-example" tabindex="-1"><a class="header-anchor" href="#usage-example" aria-hidden="true">#</a> Usage Example</h1><blockquote><p>Here is an introduction to the basic working method of <code>YukiHookAPI</code> and a list of simple Hook examples and common functions.</p></blockquote><h2 id="structure-diagram" tabindex="-1"><a class="header-anchor" href="#structure-diagram" aria-hidden="true">#</a> Structure Diagram</h2><blockquote><p>The structure below describes the basic working and principle of <code>YukiHookAPI</code>.</p></blockquote><div class="language-text ext-text"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#adbac7;">Host Environment</span></span>
<span class="line"><span style="color:#adbac7;">└── YukiMemberHookCreator</span></span>
<span class="line"><span style="color:#adbac7;"> └── Class</span></span>
<span class="line"><span style="color:#adbac7;"> └── MemberHookCreator</span></span>
<span class="line"><span style="color:#adbac7;"> └── Member</span></span>
<span class="line"><span style="color:#adbac7;"> ├── Before</span></span>
<span class="line"><span style="color:#adbac7;"> └── After</span></span>
<span class="line"><span style="color:#adbac7;"> MemberHookCreator</span></span>
<span class="line"><span style="color:#adbac7;"> └── Member</span></span>
<span class="line"><span style="color:#adbac7;"> ├── Before</span></span>
<span class="line"><span style="color:#adbac7;"> └── After</span></span>
<span class="line"><span style="color:#adbac7;"> ...</span></span>
<span class="line"><span style="color:#adbac7;"> YukiResourcesHookCreator</span></span>
<span class="line"><span style="color:#adbac7;"> └── Resources</span></span>
<span class="line"><span style="color:#adbac7;"> └── ResourcesHookCreator</span></span>
<span class="line"><span style="color:#adbac7;"> └── Drawable</span></span>
<span class="line"><span style="color:#adbac7;"> └── Replace</span></span>
<span class="line"><span style="color:#adbac7;"> ResourcesHookCreator</span></span>
<span class="line"><span style="color:#adbac7;"> └── Layout</span></span>
<span class="line"><span style="color:#adbac7;"> └── Inject</span></span>
<span class="line"><span style="color:#adbac7;"> ...</span></span>
<span class="line"><span style="color:#adbac7;"></span></span></code></pre></div><blockquote><p>The above structure can be written in the following form in code.</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:#F69D50;">TargetClass</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</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;"> beforeHook {</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;"> afterHook {</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 style="color:#ADBAC7;">}</span></span>
<span class="line"><span style="color:#ADBAC7;">resources().hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectResource {</span></span>
<span class="line"><span style="color:#ADBAC7;"> conditions {</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;"> replaceTo(...)</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 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><h2 id="demo" tabindex="-1"><a class="header-anchor" href="#demo" aria-hidden="true">#</a> Demo</h2><blockquote><p>You can find the demo provided by the API below to learn how to use <code>YukiHookAPI</code>.</p></blockquote><ul><li><p>Host App Demo <a href="https://github.com/fankes/YukiHookAPI/tree/master/demo-app" target="_blank" rel="noopener noreferrer">click here to view<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></p></li><li><p>Module App Demo <a href="https://github.com/fankes/YukiHookAPI/tree/master/demo-module" target="_blank" rel="noopener noreferrer">click here to view<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></p></li></ul><p>Install the Host App and Module App Demo at the same time, and test the hooked function in the Host App by activating the Module App.</p><h2 id="a-simple-hook-example" tabindex="-1"><a class="header-anchor" href="#a-simple-hook-example" aria-hidden="true">#</a> A Simple Hook Example</h2><blockquote><p>Here are examples of Hook App, Hook System Framework and Hook Resources for reference.</p></blockquote><h3 id="hook-app" tabindex="-1"><a class="header-anchor" href="#hook-app" aria-hidden="true">#</a> Hook App</h3><p>Suppose, we want to hook the <code>onCreate</code> method in <code>com.android.browser</code> and show a dialog.</p><p>Add code in the body of the <code>encase</code> method.</p><blockquote><p>The following example</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:#ADBAC7;">loadApp(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.android.browser&quot;</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">ActivityClass</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;onCreate&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> param(</span><span style="color:#F69D50;">BundleClass</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> returnType </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">UnitType</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">AlertDialog</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">Builder</span><span style="color:#ADBAC7;">(instance())</span></span>
<span class="line"><span style="color:#ADBAC7;"> .setTitle(</span><span style="color:#96D0FF;">&quot;Hooked&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .setMessage(</span><span style="color:#96D0FF;">&quot;I am hook!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .setPositiveButton(</span><span style="color:#96D0FF;">&quot;OK&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#6CB6FF;">null</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .show()</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</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 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>At this point, the <code>onCreate</code> method will be successfully hooked and this dialog will show when every <code>Activity</code> in <code>com.android.browser</code> starts.</p><p>So, what should I do if I want to continue the Hook <code>onStart</code> method?</p><p>In the code just now, continue to insert an <code>injectMember</code> method body.</p><blockquote><p>The following example</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:#ADBAC7;">loadApp(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.android.browser&quot;</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">ActivityClass</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;onCreate&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> param(</span><span style="color:#F69D50;">BundleClass</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> returnType </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">UnitType</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">AlertDialog</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">Builder</span><span style="color:#ADBAC7;">(instance())</span></span>
<span class="line"><span style="color:#ADBAC7;"> .setTitle(</span><span style="color:#96D0FF;">&quot;Hooked&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .setMessage(</span><span style="color:#96D0FF;">&quot;I am hook!&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .setPositiveButton(</span><span style="color:#96D0FF;">&quot;OK&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#6CB6FF;">null</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> .show()</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;onStart&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> emptyParam()</span></span>
<span class="line"><span style="color:#ADBAC7;"> returnType </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">UnitType</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</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 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 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>For the <code>Class</code> that does not exist in the current project, you can use the <code>stub</code> method or the <code>findClass</code> method to get the class that needs to be hooked.</p><p>For example, I want to get <code>com.example.demo.TestClass</code>.</p><blockquote><p>The following example</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:#ADBAC7;">findClass(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.example.demo.TestClass&quot;</span><span style="color:#ADBAC7;">).hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</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></div><p>If <code>com.example.demo</code> is the app you want to hook, then the writing method can be simpler.</p><blockquote><p>The following example</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:#ADBAC7;">findClass(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;$packageName.TestClass&quot;</span><span style="color:#ADBAC7;">).hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</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></div><p>Some people may have started to say that <code>findClass</code> is a bit cumbersome in some scenarios.</p><p>Because some people may have the following needs.</p><blockquote><p>The following example</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;">const</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">TestClass</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.example.demo.TestClass&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#F69D50;">TestClass</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</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><p>That&#39;s okay, you can also create a Hook directly using the string class name.</p><blockquote><p>The following example</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:#96D0FF;">&quot;$packageName.TestClass&quot;</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</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></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#memberhookcreator-class">MemberHookCreator</a>.</p></div><h3 id="hook-zygote" tabindex="-1"><a class="header-anchor" href="#hook-zygote" aria-hidden="true">#</a> Hook Zygote</h3><p>The first event <code>initZygote</code> after the new process is forked when the app starts.</p><p>Suppose we want to globally Hook the <code>onCreate</code> event of an app <code>Activity</code></p><p>Add code in the body of the <code>encase</code> method.</p><blockquote><p>The following example</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:#ADBAC7;">loadZygote {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">ActivityClass</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;onCreate&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> param(</span><span style="color:#F69D50;">BundleClass</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> returnType </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">UnitType</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</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 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 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">Notice</p><p>The functionality performed in <strong>loadZygote</strong> is very limited, and the <strong>loadZygote</strong> method is rarely needed.</p></div><h3 id="hook-system-framework" tabindex="-1"><a class="header-anchor" href="#hook-system-framework" aria-hidden="true">#</a> Hook System Framework</h3><p>In <code>YukiHookAPI</code>, the implementation of the Hook System Framework is very simple.</p><p>Suppose, you want to get <code>ApplicationInfo</code> and <code>PackageInfo</code> and do something with them.</p><p>Add code in the body of the <code>encase</code> method.</p><blockquote><p>The following example</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:#ADBAC7;">loadSystem {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">ApplicationInfoClass</span><span style="color:#ADBAC7;">.hook {</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:#F69D50;">PackageInfoClass</span><span style="color:#ADBAC7;">.hook {</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 class="line-number"></div></div></div><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p><strong>loadZygote</strong> is directly different from <strong>loadSystem</strong>, <strong>loadZygote</strong> will be loaded in <strong>initZygote</strong>, and the System Framework is regarded as <strong>loadApp(name = &quot;android&quot;)</strong> and exists, To Hook the System Framework, you can use <strong>loadSystem</strong> directly.</p></div><h3 id="hook-resources" tabindex="-1"><a class="header-anchor" href="#hook-resources" aria-hidden="true">#</a> Hook Resources</h3><p>Suppose, we want to replace the content of <code>app_name</code> of type <code>string</code> in Hook <code>com.android.browser</code> with <code>123</code>.</p><p>Add code in the body of the <code>encase</code> method.</p><blockquote><p>The following example</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:#ADBAC7;">loadApp(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.android.browser&quot;</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;"> resources().hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectResource {</span></span>
<span class="line"><span style="color:#ADBAC7;"> conditions {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;app_name&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> string()</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> replaceTo(</span><span style="color:#96D0FF;">&quot;123&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</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 class="line-number"></div><div class="line-number"></div></div></div><p>If the current app has a title bar text set with <code>app_name</code>, it will become our <code>123</code>.</p><p>You can also replace the Hook App&#39;s Resources with the current Xposed Module&#39;s Resources.</p><p>Suppose, we want to continue to hook <code>ic_launcher</code> of type <code>mipmap</code> in <code>com.android.browser</code>.</p><blockquote><p>The following example</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:#ADBAC7;">loadApp(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.android.browser&quot;</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;"> resources().hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectResource {</span></span>
<span class="line"><span style="color:#ADBAC7;"> conditions {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;ic_launcher&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> mipmap()</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> replaceToModuleResource(</span><span style="color:#F69D50;">R</span><span style="color:#ADBAC7;">.mipmap.ic_launcher)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</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 class="line-number"></div><div class="line-number"></div></div></div><p>At this point, the icon of the target app will be replaced with the icon we set.</p><p>If you want to replace the Resources of the System Framework, you can do the same, just replace <code>loadApp</code> with <code>loadZygote</code>.</p><blockquote><p>The following example</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:#ADBAC7;">loadZygote {</span></span>
<span class="line"><span style="color:#ADBAC7;"> resources().hook {</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></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator#resourceshookcreator-class">ResourcesHookCreator</a>.</p></div><h3 id="remove-hook" tabindex="-1"><a class="header-anchor" href="#remove-hook" aria-hidden="true">#</a> Remove Hook</h3><p>The native Xposed provides us with a <code>XC_MethodHook.Unhook</code> function, which can remove the current Hook from the Hook queue, and <code>YukiHookAPI</code> can also implement this function.</p><p>The first way, save the <code>Result</code> instance of the current injected object, and call <code>remove</code> at the appropriate time and place to remove the injected object.</p><blockquote><p>The following example</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:#768390;">// Set a variable to save the current instance</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> hookResult </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;test&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> returnType </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">UnitType</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</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>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"><span style="color:#768390;">// Call the following method when appropriate</span></span>
<span class="line"><span style="color:#ADBAC7;">hookResult.remove()</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></div><p>The second method, call <code>removeSelf</code> in the Hook callback method to remove itself.</p><blockquote><p>The following example</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:#ADBAC7;">injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;test&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;"> returnType </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">UnitType</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Just call the following method directly</span></span>
<span class="line"><span style="color:#ADBAC7;"> removeSelf()</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 class="line-number"></div></div></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#memberhookcreator-class">MemberHookCreator</a>.</p></div><h2 id="exception-handling" tabindex="-1"><a class="header-anchor" href="#exception-handling" aria-hidden="true">#</a> Exception Handling</h2><blockquote><p><code>YukiHookAPI</code> has redesigned the monitoring of exceptions, any exception will not be thrown during the hook process, to avoid interrupting the next hook process and causing the hook process to &quot;die&quot;.</p></blockquote><h3 id="listen-for-exceptions" tabindex="-1"><a class="header-anchor" href="#listen-for-exceptions" aria-hidden="true">#</a> Listen for Exceptions</h3><p>You can handle exceptions that occur during the Hook method.</p><blockquote><p>The following example</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:#ADBAC7;">injectMember {</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;">}.result {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Handle the exception at the start of the hook</span></span>
<span class="line"><span style="color:#ADBAC7;"> onHookingFailure {}</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Handle exceptions in the hook process</span></span>
<span class="line"><span style="color:#ADBAC7;"> onConductFailure { param, throwable </span><span style="color:#F47067;">-&gt;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Handle all exceptions</span></span>
<span class="line"><span style="color:#ADBAC7;"> onAllFailure {}</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>
<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>This method also works in the Resources Hook.</p><blockquote><p>The following example</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:#ADBAC7;">injectResource {</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;">}.result {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Handle arbitrary exceptions when hooking</span></span>
<span class="line"><span style="color:#ADBAC7;"> onHookingFailure {}</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>
<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><p>You can also handle exceptions that occur when the Hook&#39;s <code>Class</code> does not exist.</p><blockquote><p>The following example</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:#F69D50;">TargetClass</span><span style="color:#ADBAC7;">.hook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> injectMember {</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;">}.onHookClassNotFoundFailure {</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></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><p>You can also handle exceptions when looking up methods.</p><blockquote><p>The following example</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:#ADBAC7;">method {</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;">}.onNoSuchMethod {</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></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></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#result-class">MemberHookCreator.Result</a>, <a href="../api/public/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator#result-class">ResourcesHookCreator.Result</a>.</p></div><p>Common exceptions that may occur are described here. For more information, please refer to <a href="../config/api-exception">API Exception Handling</a>.</p><h3 id="throw-an-exception" tabindex="-1"><a class="header-anchor" href="#throw-an-exception" aria-hidden="true">#</a> Throw an Exception</h3><p>In some cases, you can <strong>manually throw exceptions</strong> to alert some functionality that there is a problem.</p><p>As mentioned above, the exception thrown in the <code>hook</code> method body will be taken over by the <code>YukiHookAPI</code> to avoid interrupting the next Hook process and causing the Hook process to &quot;die&quot;.</p><p>Here&#39;s how these exceptions work when <code>YukiHookAPI</code> takes over.</p><blockquote><p>The following example</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:#768390;">// &lt;Scenario 1&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">throw</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">RuntimeException</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Exception Test&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</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>
<span class="line"><span style="color:#ADBAC7;">}.result {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Can catch RuntimeException</span></span>
<span class="line"><span style="color:#ADBAC7;"> onHookingFailure {}</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"><span style="color:#768390;">// &lt;Scenario 2&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</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>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">throw</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">RuntimeException</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Exception Test&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }</span></span>
<span class="line"><span style="color:#ADBAC7;">}.result {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#768390;">// Can catch RuntimeException</span></span>
<span class="line"><span style="color:#ADBAC7;"> onConductFailure { param, throwable </span><span style="color:#F47067;">-&gt;</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 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>The above scenarios will only be processed in the (Xposed) Host App environment and will not have any impact on the host itself.</p><p>If we want to throw these exceptions directly to the Host App, the native Xposed provides us with the <code>param.throwable</code> method, and <code>YukiHookAPI</code> can also implement this function.</p><p>If you want to throw an exception directly to the Host App in the Hook callback method body, you can implement the following methods.</p><blockquote><p>The following example</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:#ADBAC7;">injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</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>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">RuntimeException</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Exception Test&quot;</span><span style="color:#ADBAC7;">).throwToApp()</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></div><p>You can also throw exceptions directly in the Hook callback method body, and then mark the exception to be thrown to the Host App.</p><blockquote><p>The following example</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:#ADBAC7;">injectMember {</span></span>
<span class="line"><span style="color:#ADBAC7;"> method {</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>
<span class="line"><span style="color:#ADBAC7;"> afterHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">throw</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">RuntimeException</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;Exception Test&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;"> }.onFailureThrowToApp()</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><p>The above two methods can receive an exception at the Host App and cause the Host App process to crash.</p><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>In order to ensure that the Hook calling domain and the calling domain within the Host App are isolated from each other, exceptions can only be thrown to the Host App in the <strong>beforeHook</strong> and <strong>afterHook</strong> callback method bodies.</p></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/param/HookParam#throwable-throwtoapp-i-ext-method">Throwable.throwToApp</a>, <a href="../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#hookcallback-class">YukiMemberHookCreator.MemberMookCreator.HookCallback</a>.</p></div><h2 id="status-monitor" tabindex="-1"><a class="header-anchor" href="#status-monitor" aria-hidden="true">#</a> Status Monitor</h2><p>People who use <code>XposedHelpers</code> often print <code>Unhook</code> after the Hook to determine whether the Hook is successful.</p><p>In <code>YukiHookAPI</code>, you can easily reimplement this functionality with the following methods.</p><p>First we can monitor that the Hook is ready to start.</p><blockquote><p>The following example</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:#F69D50;">YourClass</span><span style="color:#ADBAC7;">.hook {</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;">}.onPrepareHook {</span></span>
<span class="line"><span style="color:#ADBAC7;"> loggerD(msg </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;$instanceClass hook start&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></div><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p><strong>instanceClass</strong> is recommended to be used only in <strong>onPrepareHook</strong>, otherwise the Hook&#39;s <strong>Class</strong> does not exist and an uninterceptable exception will be thrown, causing the Hook process to &quot;die&quot;.</p></div><p>Then, we can also monitor the success of the method result of the Hook.</p><blockquote><p>The following example</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:#ADBAC7;">injectMember {</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;">}.onHooked { member </span><span style="color:#F47067;">-&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;"> loggerD(msg </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;$member has hooked&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></div><h2 id="expansion-usage" tabindex="-1"><a class="header-anchor" href="#expansion-usage" aria-hidden="true">#</a> Expansion Usage</h2><blockquote><p>You can use the following methods to easily implement various judgments and functions in the Hook process.</p></blockquote><h3 id="multiple-hosts" tabindex="-1"><a class="header-anchor" href="#multiple-hosts" aria-hidden="true">#</a> Multiple Hosts</h3><p>If your Module App needs to handle Hook events of multiple apps at the same time, you can use the <code>loadApp</code> method body to distinguish the app you want to hook.</p><blockquote><p>The following example</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:#ADBAC7;">loadApp(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.android.browser&quot;</span><span style="color:#ADBAC7;">) {</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;">loadApp(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;com.android.phone&quot;</span><span style="color:#ADBAC7;">) {</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></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></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/param/PackageParam#loadapp-method">PackageParam.loadApp</a>.</p></div><h3 id="multiple-processes" tabindex="-1"><a class="header-anchor" href="#multiple-processes" aria-hidden="true">#</a> Multiple Processes</h3><p>If your Hook&#39;s Host App has multiple processes, you can use the <code>withProcess</code> method body to hook them separately.</p><blockquote><p>The following example</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:#ADBAC7;">withProcess(mainProcessName) {</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;">withProcess(name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;$packageName:tool&quot;</span><span style="color:#ADBAC7;">) {</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></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></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/hook/param/PackageParam#withprocess-method">PackageParam.withProcess</a>.</p></div><h2 id="writing-optimization" tabindex="-1"><a class="header-anchor" href="#writing-optimization" aria-hidden="true">#</a> Writing Optimization</h2><p>To make the code more concise, you can omit the name of <code>YukiHookAPI</code> and write your <code>onHook</code> entry as <code>lambda</code>.</p><blockquote><p>The following example</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;">onHook</span><span style="color:#ADBAC7;">() </span><span style="color:#F47067;">=</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></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><h2 id="xposed-module-own-active-state" tabindex="-1"><a class="header-anchor" href="#xposed-module-own-active-state" aria-hidden="true">#</a> Xposed Module own Active State</h2><p>Usually, we choose to write a method that return <code>false</code>, and then Hook this method to return <code>true</code> to prove that the Hook has taken effect.</p><p>In <code>YukiHookAPI</code>, you don&#39;t need to do this at all. <code>YukiHookAPI</code> has already encapsulated this operation for you, and you can use it directly.</p><p>Now, you can use <code>YukiHookAPI.Status.isXposedModuleActive</code> directly in the Module App to determine whether it is active.</p><blockquote><p>The following example</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;">if</span><span style="color:#ADBAC7;">(</span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">Status</span><span style="color:#ADBAC7;">.isXposedModuleActive) {</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></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>Due to some special reasons, Module Apps in TaiChi and Wuji cannot use standard methods to detect the activation state.</p><p>At this point, you can use <code>YukiHookAPI.Status.isTaiChiModuleActive</code> to determine whether it is activated.</p><blockquote><p>The following example</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;">if</span><span style="color:#ADBAC7;">(</span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">Status</span><span style="color:#ADBAC7;">.isTaiChiModuleActive) {</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></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>If you want to use both judgment schemes, <code>YukiHookAPI</code> also encapsulates a convenient way for you.</p><p>At this point, you can use <code>YukiHookAPI.Status.isModuleActive</code> to determine whether you are activated in Xposed or TaiChi and Promise.</p><blockquote><p>The following example</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;">if</span><span style="color:#ADBAC7;">(</span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">Status</span><span style="color:#ADBAC7;">.isModuleActive) {</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></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><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>For more functions, please refer to <a href="../api/public/com/highcapable/yukihookapi/YukiHookAPI#status-object">YukiHookAPI.Status</a>.</p></div><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>If the activation state of TaiChi and Wuji is included in the Module App activation judgment, the <strong>Application</strong> of the Module App must be extends <strong>ModuleApplication</strong> or <strong>ModuleApplication</strong> must be used directly;</p><p>The API after <strong>1.0.91</strong> has modified the activation logic judgment method, now you can use this API in the Module App and Host App at the same time;</p><p>Need to make sure <strong>YukiHookAPI.Configs.isEnableHookModuleStatus</strong> is enabled;</p><p>Except for Hook Frameworks that provide standard APIs, Module Apps may not be able to determine whether they are activated in other cases.</p></div></div><!--[--><!--]--></div><footer class="page-meta"><div class="meta-item edit-link"><a class="external-link meta-item-label" href="https://github.com/fankes/YukiHookAPI/edit/master/docs/src/en/guide/example.md" rel="noopener noreferrer" target="_blank" aria-label="Edit this page on Github"><!--[--><!--]--> Edit this page on Github <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a></div><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><!----></div><div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: qzmmcn@163.com">fankesyooni</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"><a href="/YukiHookAPI/en/guide/quick-start.html" class="" aria-label="Quick Start"><!--[--><!--]--> Quick Start <!--[--><!--]--></a></span><span class="next"><a href="/YukiHookAPI/en/guide/move-to-new-api.html" class="" aria-label="Migrate from Xposed API"><!--[--><!--]--> Migrate from Xposed API <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
<script type="module" src="/YukiHookAPI/assets/app.fb8271cf.js" defer></script>
</body>
</html>