简体   繁体   中英

how to close/finish System AppInfo Screen from my app

how to close/finish System AppInfo Screen from my application. actually System AppInfo Screen open directly from my application by below code

 public static void showInstalledAppDetails(Context context, String packageName) {
    Intent intent = new Intent();
    final int apiLevel = Build.VERSION.SDK_INT;
    if (apiLevel >= 9) { // above 2.3
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.putExtra("frommyapp", true);
        Uri uri = Uri.fromParts(SCHEME, packageName, null);
        intent.setData(uri);
    } else { // below 2.3
        final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22
                : APP_PKG_NAME_21);
        intent.setAction(Intent.ACTION_VIEW);
        intent.putExtra("frommyapp", true);
        intent.setClassName(APP_DETAILS_PACKAGE_NAME,
                APP_DETAILS_CLASS_NAME);
        intent.putExtra(appPkgName, packageName);
    }
    intent.putExtra("extraData", "somedata");
    context.startActivity(intent);
}

after open system appinfo screen then i want to close/finish system appinfo screen when click "Force Stop" button without back button press

so please help me to solve this type of issues.

I solved this issue myself..

use `finishActivity(requestcode);

when you start activity by

startActivityForResult(intent,requestcode);

use this requestcode at the time of finishactivity by

finishActivity(requestcode);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM