Example usage for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS

List of usage examples for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS

Introduction

In this page you can find the example usage for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS.

Prototype

String ACTION_APPLICATION_DETAILS_SETTINGS

To view the source code for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS.

Click Source Link

Document

Activity Action: Show screen of details about a particular application.

Usage

From source file:com.xiaodu.permission.util2.ESPermission.java

public static boolean checkDeniedPermissionsNeverAskAgain(final Activity activity, String rationale,
        @StringRes int positiveButton, @StringRes int negativeButton, List<String> deniedPerms) {
    boolean shouldShowRationale;
    for (String perm : deniedPerms) {
        shouldShowRationale = shouldShowRequestPermissionRationale(activity, perm);
        if (!shouldShowRationale) {
            if (null == getActivity(activity)) {
                return true;
            }/*ww  w .  j av a2 s. co m*/

            AlertDialog dialog = new AlertDialog.Builder(activity).setMessage(rationale)
                    .setPositiveButton(positiveButton, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                            Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
                            intent.setData(uri);
                            startAppSettingsScreen(activity, intent);
                        }
                    }).setNegativeButton(negativeButton, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {

                        }
                    }).create();
            dialog.show();

            return true;
        }
    }

    return false;
}

From source file:com.netease.hearttouch.htimagepicker.core.util.permission.PermissionsActivity.java

private void startAppSettings() {
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    intent.setData(Uri.parse(PACKAGE_URL_SCHEME + getPackageName()));
    startActivity(intent);//from   w  w  w .  j  a v  a  2  s.c  om
}

From source file:me.egorand.contactssync.ui.activities.MainActivity.java

private void goToSettings() {
    Uri uri = Uri.fromParts("package", getPackageName(), null);
    Intent settingsIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, uri);
    settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(settingsIntent);//w  w w . j a  va2 s  . c  om
}

From source file:com.hmatalonga.greenhub.ui.TaskListActivity.java

@Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenTaskDetailsEvent(OpenTaskDetailsEvent event) {
    startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
            Uri.parse("package:" + event.task.getPackageInfo().packageName)));
}

From source file:cn.qqjlbsc.shopseller.utlis.EasyPermissions.java

public static boolean checkDeniedPermissionsNeverAskAgain(final Object object, String rationale,
        @StringRes int positiveButton, @StringRes int negativeButton,
        @Nullable DialogInterface.OnClickListener negativeButtonOnClickListener, List<String> deniedPerms) {
    boolean shouldShowRationale;
    for (String perm : deniedPerms) {
        shouldShowRationale = shouldShowRequestPermissionRationale(object, perm);
        if (!shouldShowRationale) {
            final Activity activity = getActivity(object);
            if (null == activity) {
                return true;
            }//from ww w. java2s  . c  o  m

            AlertDialog dialog = new AlertDialog.Builder(activity).setMessage(rationale)
                    .setPositiveButton(positiveButton, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                            Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
                            intent.setData(uri);
                            startAppSettingsScreen(object, intent);
                        }
                    }).setNegativeButton(negativeButton, negativeButtonOnClickListener).create();
            dialog.show();

            return true;
        }
    }

    return false;
}

From source file:com.king.base.util.SystemUtils.java

/**
 * app?/* ww  w .  j a  v a 2 s . c  o m*/
 * @param context
 */
public static void startAppDetailSetings(Context context) {
    Uri uri = Uri.fromParts("package", context.getPackageName(), null);
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, uri);
    context.startActivity(intent);
}

From source file:com.ivanmagda.inventory.ui.ProductEditor.java

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
        @NonNull int[] grantResults) {
    if (requestCode == PERMISSION_REQUEST_READ_EXTERNAL_STORAGE) {
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            startPickImageIntent();//from  w w  w  .j  av  a2  s  .  c o m
        } else {
            Snackbar.make(findViewById(android.R.id.content), R.string.enable_persmission_from_settings,
                    Snackbar.LENGTH_INDEFINITE).setAction(R.string.enable, new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Intent intent = new Intent();
                            intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                            intent.addCategory(Intent.CATEGORY_DEFAULT);
                            intent.setData(Uri.parse("package:" + getPackageName()));
                            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                            intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                            startActivity(intent);
                        }
                    }).show();
        }
    }
}

From source file:com.pranavpandey.smallapp.permission.PermissionDangerous.java

private void buildPermissionsDialog(final ArrayList<String> permissions, final boolean isRequest) {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.sas_dialog_permission, new LinearLayout(this), false);
    TextView message = (TextView) view.findViewById(R.id.permission_message);
    ViewGroup frame = (ViewGroup) view.findViewById(R.id.permission_frame);

    final ArrayList<String> permissionGroups = new ArrayList<String>();
    for (String permission : permissions) {
        try {//from  w w  w. j a va2 s .com
            PermissionInfo permInfo = getPackageManager().getPermissionInfo(permission,
                    PackageManager.GET_META_DATA);
            if (!permissionGroups.contains(permInfo.group)) {
                permissionGroups.add(permInfo.group);
            }
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
    }

    for (String permissionGroup : permissionGroups) {
        try {
            PermissionGroupInfo permGroupInfo = getPackageManager().getPermissionGroupInfo(permissionGroup,
                    PackageManager.GET_META_DATA);
            frame.addView(new PermissionItem(this, permGroupInfo.loadIcon(getPackageManager()),
                    permGroupInfo.loadLabel(getPackageManager()).toString(),
                    permGroupInfo.loadDescription(getPackageManager()).toString()));
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
    }

    if (isRequest) {
        message.setText(R.string.sas_perm_request_desc);
    } else {
        message.setText(String.format(getString(R.string.sas_format_next_line),
                getString(R.string.sas_perm_request_desc), getString(R.string.sas_perm_request_info)));
    }

    try {
        alertDialogBuilder.setIcon(
                DynamicTheme.createDialogIcon(this, getPackageManager().getApplicationIcon(getPackageName())));
    } catch (Exception e) {
        e.printStackTrace();
    }
    alertDialogBuilder.setTitle(getApplicationInfo().loadLabel(getPackageManager()).toString())
            .setPositiveButton(isRequest ? R.string.sas_perm_request : R.string.sas_perm_continue,
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int id) {
                            if (isRequest) {
                                requestPermissions(permissions.toArray(new String[permissions.size()]));
                            } else {
                                openPermissionSettings(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                            }
                        }
                    })
            .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    finishPermissionsChecker();
                }
            }).setCancelable(false);

    final AlertDialog dialog = alertDialogBuilder.create();
    dialog.setView(view, 0, SmallUtils.getDialogTopPadding(this), 0, 0);

    showPermissionDialog(dialog);
}

From source file:com.sportsapp.MainActivity.java

private void openAppDetails() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(//from   www .j a va 2s  . c  o  m
            "? Camera?  ? ? -> ??? ?");
    builder.setPositiveButton("?", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent();
            intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
            intent.setData(Uri.parse("package:" + getPackageName()));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
            startActivity(intent);
        }
    });
    builder.setNegativeButton("?", null);
    builder.show();
}

From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java

private void startInstalledAppDetailsActivity(final Activity context) {
    if (context == null) {
        return;/*from  w  w  w.j  a v  a 2 s  . co m*/
    }
    final Intent i = new Intent();
    i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setData(Uri.parse("package:" + context.getPackageName()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    context.startActivity(i);
}