120.Android 简单的跳转到系统设置默认应用页面,跳转到设置默认短信页面

                    //跳转到默认应用界面 第一种方式
                    Intent intent = new Intent();
                    ComponentName componentName = new ComponentName("com.android.settings", "com.android.settings.Settings$AdvancedAppsActivity");
                    intent.setComponent(componentName);
                    startActivity(intent);

//跳转到设置默认应用页面 第二种方式
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS);
startActivity(intent);
//跳转到设置默认短信页面
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.SubSettings"));
intent.putExtra(":settings:show_fragment", "com.android.settings.applications.defaultapps.DefaultSmsPicker");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
        //判断当前应用是否是默认短信
//        String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(this);
//        if (null == defaultSmsApp || TextUtils.isEmpty(defaultSmsApp)||!defaultSmsApp.equals(getPackageName())) {
//            //不是默认短信
//        }



                    //跳转到系统应用管理列表界面
//                    Intent intent = new Intent(Settings.ACTION_APPLICATION_SETTINGS);
//                    startActivity(intent);

                    //跳转到系统应用管理页面
//                    Intent intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
//                    startActivity(intent);

                    //跳转到系统应用管理页面(全部界面)
//                    Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS);
//                    startActivity(intent);
        //跳转到已经安装的无障碍辅助功能页面
//        Intent intent = new Intent();
//        intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.SubSettings"));
//        intent.putExtra(":settings:show_fragment", "com.android.settings.accessibility.InstalledAccessibilityService");
//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//        startActivity(intent);

猜你喜欢

转载自blog.csdn.net/weixin_42061754/article/details/129449494
今日推荐