hacktons / zygote

Small library used to restart android application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Small library used to restart android application

License:Apache License 2.0


Languages

Language:Kotlin 97.5%Language:Shell 2.5%