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.baseframe.core.permissions.AppSettingsDialog.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private AppSettingsDialog(@NonNull final Object activityOrFragment, @NonNull final Context context,
        @NonNull String rationale, @Nullable String title, @Nullable String positiveButton,
        @Nullable String negativeButton, @Nullable DialogInterface.OnClickListener negativeListener,
        int requestCode) {

    // Create empty builder
    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.AppDialogStyle);

    // Set rationale
    dialogBuilder.setMessage(rationale);

    // Set title//w w  w.ja v  a2 s . com
    dialogBuilder.setTitle(title);

    // Positive button text, or default
    String positiveButtonText = TextUtils.isEmpty(positiveButton) ? context.getString(android.R.string.ok)
            : positiveButton;

    // Negative button text, or default
    String negativeButtonText = TextUtils.isEmpty(positiveButton) ? context.getString(android.R.string.cancel)
            : negativeButton;

    // Request code, or default
    final int settingsRequestCode = requestCode > 0 ? requestCode : DEFAULT_SETTINGS_REQ_CODE;

    // Positive click listener, launches app screen
    dialogBuilder.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // Create app settings intent
            Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            Uri uri = Uri.fromParts("package", context.getPackageName(), null);
            intent.setData(uri);

            // Start for result
            startForResult(activityOrFragment, intent, settingsRequestCode);
        }
    });

    // Negative click listener, dismisses dialog
    dialogBuilder.setNegativeButton(negativeButtonText, negativeListener);

    // Build dialog
    mAlertDialog = dialogBuilder.create();
}

From source file:com.jefftharris.passwdsafe.lib.DynamicPermissionMgr.java

@Override
public void onClick(View v) {
    int id = v.getId();
    if (id == itsReloadBtn.getId()) {
        checkPerms();/*from   w  ww . j  a va  2  s  .  c  om*/
    } else if (id == itsAppSettingsBtn.getId()) {
        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + itsPackageName));
        if (intent.resolveActivity(itsActivity.getPackageManager()) != null) {
            itsActivity.startActivityForResult(intent, itsAppSettingsRequestCode);
        }
    }
}

From source file:com.github.shareme.blackandroids.greenandroid.easpermissions.AppSettingsDialog.java

private AppSettingsDialog(@NonNull final Object activityOrFragment, @NonNull final Context context,
        @NonNull String rationale, @Nullable String title, @Nullable String positiveButton,
        @Nullable String negativeButton, @Nullable DialogInterface.OnClickListener negativeListener,
        int requestCode) {

    // Create empty builder
    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);

    // Set rationale
    dialogBuilder.setMessage(rationale);

    // Set title//from   w w  w . j av  a 2 s .c  om
    dialogBuilder.setTitle(title);

    // Positive button text, or default
    String positiveButtonText = TextUtils.isEmpty(positiveButton) ? context.getString(android.R.string.ok)
            : positiveButton;

    // Negative button text, or default
    String negativeButtonText = TextUtils.isEmpty(positiveButton) ? context.getString(android.R.string.cancel)
            : negativeButton;

    // Request code, or default
    final int settingsRequestCode = requestCode > 0 ? requestCode : DEFAULT_SETTINGS_REQ_CODE;

    // Positive click listener, launches app screen
    dialogBuilder.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // Create app settings intent
            Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            Uri uri = Uri.fromParts("package", context.getPackageName(), null);
            intent.setData(uri);

            // Start for result
            startForResult(activityOrFragment, intent, settingsRequestCode);
        }
    });

    // Negative click listener, dismisses dialog
    dialogBuilder.setNegativeButton(negativeButtonText, negativeListener);

    // Build dialog
    mAlertDialog = dialogBuilder.create();
}

From source file:com.idlab.idcorp.assignment_android.common.utils.PermissionUtil.java

public static void showRationalDialog(final Context context, String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(context.getString(R.string.permission_dialog_title)).setMessage(message).setPositiveButton(
            context.getString(R.string.permission_dialog_setting), new DialogInterface.OnClickListener() {
                @Override/*from  w w  w. j a v  a  2  s  .co m*/
                public void onClick(DialogInterface dialog, int which) {
                    try {
                        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
                                .setData(Uri.parse("package:" + context.getPackageName()));
                        context.startActivity(intent);
                    } catch (ActivityNotFoundException e) {
                        e.printStackTrace();
                        Intent intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
                        context.startActivity(intent);
                    }
                }
            }).setNegativeButton(context.getString(R.string.permission_dialog_close), null);
    builder.show();
}

From source file:com.mattprecious.notisync.fragment.SamsungTtsDialogFragment.java

private void launchAppSettings(String app) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    intent.setData(Uri.fromParts("package", app, null));
    startActivity(intent);//w  w  w. j  a va 2 s .c o m
}

From source file:io.hypertrack.sendeta.util.PermissionUtils.java

public static void openSettings(Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
    intent.setData(uri);//from ww w  .  j  a v  a  2  s  . c  o  m
    activity.startActivity(intent);
}

From source file:com.google.android.apps.muzei.gallery.GallerySettingsProxyActivity.java

@Override
@TargetApi(Build.VERSION_CODES.M)/*ww  w.j av  a 2s  .co m*/
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode != REQUEST_READ_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE) {
        return;
    }

    if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
        verifyOrRequestPermission();
    } else if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[0])) {
        new AlertDialog.Builder(this, R.style.Theme_Muzei_Dialog)
                .setTitle(R.string.gallery_permission_dialog_hard_title)
                .setMessage(R.string.gallery_permission_dialog_hard_message)
                .setPositiveButton(R.string.gallery_permission_dialog_hard_positive_title,
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                finish();
                                setResult(RESULT_CANCELED);
                                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                                Uri uri = Uri.fromParts("package", getPackageName(), null);
                                intent.setData(uri);
                                startActivity(intent);
                            }
                        })
                .setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        finish();
                        setResult(RESULT_CANCELED);
                    }
                }).setNegativeButton(R.string.gallery_permission_dialog_hard_negative_title, null).show();
    } else {
        finish();
        setResult(RESULT_CANCELED);
    }
}

From source file:ru.dublgis.androidhelpers.DesktopUtils.java

public static void showApplicationSettings(final Context ctx) {
    try {/*from   www .jav a  2s.  c om*/
        final Intent intent = new Intent();

        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.setData(Uri.fromParts("package", ctx.getPackageName(), null));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

        ctx.startActivity(intent);
    } catch (final Throwable throwable) {
        Log.e(TAG, "showApplicationSettings throwable: " + throwable);
    }
}

From source file:com.giovanniterlingen.windesheim.view.NatschoolActivity.java

public void noPermission() {
    Snackbar snackbar = Snackbar.make(view, getResources().getString(R.string.no_permission),
            Snackbar.LENGTH_LONG);//  ww w.  j  av  a2s.c  o m
    snackbar.setAction(getResources().getString(R.string.fix), new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            Uri uri = Uri.fromParts("package", getPackageName(), null);
            intent.setData(uri);
            startActivity(intent);
        }
    });
    snackbar.show();
}

From source file:com.whatsappcamera.RunTimePermission.java

private void callSettingActivity() {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
    intent.setData(uri);// w  w w .  j a  v a  2s.c  o  m
    activity.startActivity(intent);

}