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.mapdirectiondemo.util.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);//from w  w w.  java2s .c o m
    activity.startActivity(intent);
}

From source file:com.andremion.louvre.StoragePermissionActivity.java

/**
 * Show UI with rationale for requesting a storage permission.
 * <p>//from  w  w w  .jav  a2 s  .com
 * "You should do this only if you do not have the permission and the context in
 * which the permission is requested does not clearly communicate to the user
 * what would be the benefit from granting this permission."
 * </p>
 */
private void showExplanation() {
    Snackbar.make(getWindow().getDecorView(),
            getString(R.string.activity_gallery_permission_request_explanation), Snackbar.LENGTH_INDEFINITE)
            .setAction(R.string.activity_gallery_permission_request_settings, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                    Uri uri = Uri.fromParts("package", getPackageName(), null);
                    intent.setData(uri);
                    startActivityForResult(intent, REQUEST_APP_SETTINGS);
                }
            }).show();
}

From source file:com.duy.pascal.ui.activities.SplashScreenActivity.java

private void gotoSystemSetting() {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", getPackageName(), null);
    intent.setData(uri);//ww w. j a  va 2  s.  co m
    startActivity(intent);
}

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

private void checkPermissions() {
    if (!new PermissionController().verifyStoragePermissions(this)) {
        if (view != null) {
            Snackbar snackbar = Snackbar.make(view, getResources().getString(R.string.no_permission),
                    Snackbar.LENGTH_LONG);
            snackbar.setAction(getResources().getString(R.string.fix), new View.OnClickListener() {
                @Override//from   ww  w . j  a  v a 2 s .  c  om
                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();
        }
        showEmptyTextview();
    }
}

From source file:com.asksven.betterbatterystats.PackageFragmentActivity.java

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);
        Uri uri = Uri.fromParts(SCHEME, packageName, null);
        intent.setData(uri);//  w w  w.  j a  v  a2s  . c o m
    } else {
        // below 2.3
        final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22 : APP_PKG_NAME_21);
        intent.setAction(Intent.ACTION_VIEW);
        intent.setClassName(APP_DETAILS_PACKAGE_NAME, APP_DETAILS_CLASS_NAME);
        intent.putExtra(appPkgName, packageName);
    }
    context.startActivity(intent);
}

From source file:org.adblockplus.android.AdblockPlus.java

/**
 * Opens Android application settings//from w ww  .j a va 2  s  .co m
 */
public static void showAppDetails(Context context) {
    String packageName = context.getPackageName();
    Intent intent = new Intent();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        // above 2.3
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        Uri uri = Uri.fromParts("package", packageName, null);
        intent.setData(uri);
    } else {
        // below 2.3
        final String appPkgName = (Build.VERSION.SDK_INT == Build.VERSION_CODES.FROYO ? "pkg"
                : "com.android.settings.ApplicationPkgName");
        intent.setAction(Intent.ACTION_VIEW);
        intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
        intent.putExtra(appPkgName, packageName);
    }
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:com.airg.android.permission.sample.MainActivity.java

private void gotoSettings() {
    final Intent intent;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                Uri.fromParts("package", getPackageName(), null));
    } else {/*from   w ww. j  av a 2  s  . co  m*/
        intent = new Intent(Intent.ACTION_VIEW);
        intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
        intent.putExtra(Build.VERSION.SDK_INT == Build.VERSION_CODES.FROYO ? "pkg"
                : "com.android.settings.ApplicationPkgName", getPackageName());
    }

    startActivityForResult(intent, REQUEST_SETTINGS);
}

From source file:com.google.samples.apps.iosched.util.PermissionsUtils.java

private static Snackbar displayPermissionDeniedAppInfoResolutionSnackbar(@NonNull final Activity activity,
        final int messageResId, final boolean isPersistent) {
    View view = UIUtils.getRootView(activity);
    final int length = isPersistent ? Snackbar.LENGTH_INDEFINITE : Snackbar.LENGTH_LONG;

    Snackbar snackbar = Snackbar.make(view, messageResId, length).setAction(R.string.ok,
            new View.OnClickListener() {
                @Override/*w  w  w.  j  av a2s. c  o  m*/
                public void onClick(final View v) {
                    LOGI(TAG, "Invoking App Info screen");
                    final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                    Uri uri = Uri.fromParts("package", BuildConfig.APPLICATION_ID, null);
                    intent.setData(uri);
                    activity.startActivity(intent);
                }
            });
    snackbar.show();
    return snackbar;
}

From source file:co.vanir.indecentxposure.IndecentXposure.java

public static void notify(final Context context, final String exampleString) {
    final Resources res = context.getResources();

    final String ticker = exampleString;
    final String title = res.getString(R.string.solve_problems_notification_title); //_template, exampleString);
    final String text = res.getString(R.string.solve_problems_notification_placeholder_text_template);//, exampleString);

    //one button opens the "uninstall app" settings page
    final Intent removeIntent = new Intent();
    removeIntent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", SerialOffender.getPackageName(), null);
    removeIntent.setData(uri);/*from www  . j  a  v a 2s.  co m*/

    //the other option will hide the notification until the user uninstalls and reinstalls
    //  the installer
    final Intent ignoreIntent = new Intent();
    ignoreIntent.setAction("co.vanir.indecentxposure.IGNORE_LIKELY_FUNK");

    final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.drawable.ic_stat_solve_problems).setContentTitle(title).setContentText(text)
            .setPriority(NotificationCompat.PRIORITY_MAX).setTicker(ticker)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(text).setBigContentTitle(title)
                    .setSummaryText(res.getString(R.string.summary_thanks)))
            .addAction(0, res.getString(R.string.action_remove),
                    PendingIntent.getActivity(context, 0, removeIntent, PendingIntent.FLAG_UPDATE_CURRENT))
            .addAction(0, res.getString(R.string.action_accept_consequences),
                    PendingIntent.getBroadcast(context, 0, ignoreIntent, PendingIntent.FLAG_CANCEL_CURRENT));

    notify(context, builder.build(), true);
}

From source file:com.qiscus.sdk.util.QiscusPermissionsUtil.java

public static boolean checkDeniedPermissionsNeverAskAgain(Object object, String rationale,
        @StringRes int positiveButton, @StringRes int negativeButton, 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;
            }/* w  w  w.j  a va  2 s  .c o m*/

            AlertDialog dialog = new AlertDialog.Builder(activity).setMessage(rationale)
                    .setPositiveButton(positiveButton, (dialog1, which) -> {
                        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                        Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
                        intent.setData(uri);
                        activity.startActivity(intent);
                    }).setNegativeButton(negativeButton, null).create();
            dialog.show();

            return true;
        }
    }

    return false;
}