强制退出
This commit is contained in:
parent
8a7531428b
commit
9d5f4dc3a9
|
|
@ -75,6 +75,7 @@ class AndroidInterface(private val activity: MainActivity) {
|
|||
"printRawData" -> { printRawData(optStringOrNull(args, 0)); "" }
|
||||
"startUpdate" -> { startUpdate(optStringOrNull(args, 0)); "" }
|
||||
"exitApp" -> { exitApp(); "" }
|
||||
"forceExit" -> { forceExit(); "" }
|
||||
"getVersionName" -> getVersionName()
|
||||
"getAboutInfo" -> getAboutInfo()
|
||||
"saveMessage" -> { saveMessage(optStringOrNull(args, 0)); "" }
|
||||
|
|
@ -365,6 +366,17 @@ class AndroidInterface(private val activity: MainActivity) {
|
|||
}
|
||||
}
|
||||
|
||||
fun forceExit() {
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
try {
|
||||
com.stand.standapp.utils.AppKiller.killApp(activity)
|
||||
} catch (e: Exception) {
|
||||
Timber.tag("App").e(e, "强制退出失败")
|
||||
activity.finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getVersionName(): String {
|
||||
return try {
|
||||
val packageInfo = activity.packageManager.getPackageInfo(activity.packageName, 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue