mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 01:35:17 +08:00
Modify add "isOnFailureThrowToApp" param for onAppLifecycle function in PackageParam
This commit is contained in:
@@ -327,13 +327,17 @@ fun refreshModuleAppResources()
|
||||
## onAppLifecycle <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onAppLifecycle(initiate: AppLifecycle.() -> Unit)
|
||||
inline fun onAppLifecycle(isOnFailureThrowToApp: Boolean, initiate: AppLifecycle.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.5` `modified`
|
||||
|
||||
新增 `isOnFailureThrowToApp` 参数,可选择将异常在 (Xposed) 宿主环境打印而不是抛出给宿主
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 生命周期装载事件。
|
||||
@@ -975,13 +979,17 @@ resources().hook {
|
||||
## AppLifecycle <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class AppLifecycle internal constructor()
|
||||
inner class AppLifecycle internal constructor(private val isOnFailureThrowToApp: Boolean)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.5` `modified`
|
||||
|
||||
新增 `isOnFailureThrowToApp` 参数,可选择将异常在 (Xposed) 宿主环境打印而不是抛出给宿主
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前 Hook APP 的生命周期实例处理类。
|
||||
|
@@ -2,9 +2,9 @@
|
||||
|
||||
> This is an extension of the lifecycle of an automatic hooking Host App.
|
||||
|
||||
## Monitor Lifecycle
|
||||
## Listener Lifecycle
|
||||
|
||||
> Implement the monitoring function by automating the lifecycle method of the Host App.
|
||||
> Implement the listening function by automating the lifecycle method of the Host App.
|
||||
|
||||
We need to listen to the startup and lifecycle methods of the Host App's `Application`, just use the following methods.
|
||||
|
||||
@@ -13,7 +13,11 @@ We need to listen to the startup and lifecycle methods of the Host App's `Applic
|
||||
```kotlin
|
||||
loadApp(name = "com.example.demo") {
|
||||
// Register lifecycle listeners
|
||||
onAppLifecycle {
|
||||
// Optional parameter:
|
||||
// You can set isOnFailureThrowToApp = false
|
||||
// So that the exception will not be thrown to the Host App to prevent the Host App from crashing
|
||||
// The default is true
|
||||
onAppLifecycle(isOnFailureThrowToApp = true) {
|
||||
// You can implement lifecycle method listeners in Application here
|
||||
attachBaseContext { baseContext, hasCalledSuper ->
|
||||
// Determine whether
|
||||
@@ -54,7 +58,7 @@ For more functions, please refer to [AppLifecycle](../public/com/highcapable/yuk
|
||||
|
||||
## Register System Broadcast
|
||||
|
||||
> Register system broadcast through the `Application.onCreate` method to monitor system broadcast.
|
||||
> Register system broadcast through the `Application.onCreate` method to listening system broadcast.
|
||||
|
||||
We can also register system broadcast in the Host App's `Application`.
|
||||
|
||||
@@ -64,7 +68,7 @@ We can also register system broadcast in the Host App's `Application`.
|
||||
loadApp(name = "com.example.demo") {
|
||||
// Register lifecycle listeners
|
||||
onAppLifecycle {
|
||||
// Broadcast monitoring when the registered user is unlocked
|
||||
// Broadcast listening when the registered user is unlocked
|
||||
registerReceiver(Intent.ACTION_USER_PRESENT) { context, intent ->
|
||||
// ...
|
||||
}
|
||||
|
@@ -319,13 +319,17 @@ fun refreshModuleAppResources()
|
||||
## onAppLifecycle <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onAppLifecycle(initiate: AppLifecycle.() -> Unit)
|
||||
inline fun onAppLifecycle(isOnFailureThrowToApp: Boolean, initiate: AppLifecycle.() -> Unit)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.88` `新增`
|
||||
|
||||
`v1.1.5` `修改`
|
||||
|
||||
新增 `isOnFailureThrowToApp` 参数,可选择将异常在 (Xposed) 宿主环境打印而不是抛出给宿主
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 监听当前 Hook APP 生命周期装载事件。
|
||||
@@ -967,13 +971,17 @@ resources().hook {
|
||||
## AppLifecycle <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class AppLifecycle internal constructor()
|
||||
inner class AppLifecycle internal constructor(private val isOnFailureThrowToApp: Boolean)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.88` `新增`
|
||||
|
||||
`v1.1.5` `修改`
|
||||
|
||||
新增 `isOnFailureThrowToApp` 参数,可选择将异常在 (Xposed) 宿主环境打印而不是抛出给宿主
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 当前 Hook APP 的生命周期实例处理类。
|
||||
|
@@ -13,7 +13,8 @@
|
||||
```kotlin
|
||||
loadApp(name = "com.example.demo") {
|
||||
// 注册生命周期监听
|
||||
onAppLifecycle {
|
||||
// 可选参数:你可以设置 isOnFailureThrowToApp = false 使得其中的异常不会抛出给宿主防止宿主崩溃,默认为 true
|
||||
onAppLifecycle(isOnFailureThrowToApp = true) {
|
||||
// 你可以在这里实现 Application 中的生命周期方法监听
|
||||
attachBaseContext { baseContext, hasCalledSuper ->
|
||||
// 通过判断 hasCalledSuper 来确定是否已执行 super.attachBaseContext(base) 方法
|
||||
|
Reference in New Issue
Block a user