OOBE: Restart app after onboarding to renew permission scopes [1/2]
This commit is contained in:
@@ -37,6 +37,7 @@ import com.aurora.gplayapi.data.models.App
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.util.Log
|
||||
import com.aurora.store.util.Preferences
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
val Context.inflater: LayoutInflater
|
||||
get() = LayoutInflater.from(this)
|
||||
@@ -135,3 +136,15 @@ fun Context.isIgnoringBatteryOptimizations(): Boolean {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.restartApp() {
|
||||
val intent = packageManager.getLaunchIntentForPackage(packageName)
|
||||
val componentName = intent?.component
|
||||
|
||||
val newIntent = Intent.makeRestartActivityTask(componentName)
|
||||
newIntent.setPackage(packageName)
|
||||
|
||||
startActivity(newIntent)
|
||||
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user