public static void goToSettingIntent(Context context) {
Intent localIntent = new Intent();
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (Build.VERSION.SDK_INT >= 9) {
localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
localIntent.setData(Uri.fromParts("package", getPackageName(), null));
} else if (Build.VERSION.SDK_INT <= 8) {
localIntent.setAction(Intent.ACTION_VIEW);
localIntent.setClassName("com.android.settings","com.android.settings.InstalledAppDetails");
localIntent.putExtra("com.android.settings.ApplicationPkgName", getPackageName());
}
context.startActivity(localIntent);
}
本文介绍了一种在Android应用中实现跳转到应用详细设置页面的方法。通过检测Android系统的版本来选择不同的Intent设置方式,确保在不同版本的Android系统上都能正确地打开应用设置界面。
869

被折叠的 条评论
为什么被折叠?



