mirror of
https://gitee.com/myxzgzs/boyue_jnpf.git
synced 2025-08-10 00:02:41 +08:00
24 lines
841 B
Plaintext
24 lines
841 B
Plaintext
|
|
import type { RestartApp, ExitApp } from "../interface.uts";
|
|
import type { common, Want } from '@kit.Abilitykit';
|
|
import bundleManager from '@ohos.bundle.bundleManager';
|
|
import { process } from '@kit.ArkTS';
|
|
|
|
// export const reStartApp : RestartApp = () => {
|
|
// const context = UTSHarmony.getUIAbilityContext() as common.UIAbilityContext
|
|
// let applicationContext = context.getApplicationContext();
|
|
// let request : Want = {
|
|
// bundleName: bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT).name // 加载当前包名
|
|
// }
|
|
// try {
|
|
// applicationContext.restartApp(request);
|
|
// } catch (error) {
|
|
// console.error(`restartApp fail, error: ${JSON.stringify(error)}`);
|
|
// }
|
|
// }
|
|
//退出应用
|
|
|
|
export const exitApp : ExitApp = () => {
|
|
let pro = new process.ProcessManager();
|
|
pro.exit(0);
|
|
} |