Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 948 Bytes

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