Skip to content

Files

Latest commit

e7c04c9 · Jan 2, 2024

History

History
45 lines (33 loc) · 948 Bytes

README.md

File metadata and controls

45 lines (33 loc) · 948 Bytes

Zygote

Restart your application programmatically, compact for Android 10(API level 29)

Sample

window background homepage restart homepage
1.png 2.png 1.png

How to use

Add maven repo and library dependency:

repositories {
    maven {
        url = uri("https://maven.pkg.github.com/hacktons/zygote")
    }
}

dependencies {
    implementation("cn.hacktons:zygote:1.0.0")
}

Kill process directly:

App.restart(context)

Kill process by yourself:

App.restart(context) {
    Log.i(tag, "do some clean task, such as flush pending log request")
    // TODO xxx
    Process.killProcess(Process.myPid())
}

How it works

Restart main process via sub-process instead of AlarmManager.

zygote-flow.webp