List of usage examples for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS
String ACTION_APPLICATION_DETAILS_SETTINGS
To view the source code for android.provider Settings ACTION_APPLICATION_DETAILS_SETTINGS.
Click Source Link
From source file:com.sxt.chat.activity.NotifycationActivity.java
/** * ?app?/*ww w .j av a 2 s . c om*/ */ public void goToNotificationSettings() { Intent intent = new Intent(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName()); } else { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + getPackageName())); } startActivity(intent); }
From source file:com.hch.beautyenjoy.tools.IntentUtils.java
/** * Open App Detail page/* ww w . ja v a 2 s.co m*/ */ public static void openAppDetail(String packageName, Context context) { Intent intent = new Intent(); final int apiLevel = Build.VERSION.SDK_INT; if (apiLevel >= 9) { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", packageName, null); intent.setData(uri); } else { final String appPkgName = (apiLevel == 8 ? "pkg" : "com.android.settings.ApplicationPkgName"); intent.setAction(Intent.ACTION_VIEW); intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); intent.putExtra(appPkgName, packageName); } context.startActivity(intent); }
From source file:com.tasomaniac.muzei.earthview.ui.SettingsFragment.java
@Override public boolean onPreferenceClick(Preference preference) { if (permissionDeniedDefinitely) { Uri packageURI = Uri.parse("package:" + BuildConfig.APPLICATION_ID); Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packageURI); startActivity(intent);/* w ww. j a v a 2 s.c om*/ } else { requestStoragePermission(); permissionDeniedDefinitely = true; } return true; }
From source file:com.sxt.chat.activity.NotifycationActivity.java
/** * ?app? (???channel)//from w ww .ja v a 2s .c o m * * @param channel ??? */ public void goToNotificationSettings(String channel) { Intent intent = new Intent(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { intent.setAction(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName()); intent.putExtra(Settings.EXTRA_CHANNEL_ID, channel); } else { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + getPackageName())); } startActivity(intent); }
From source file:la.xiong.mylibrary.EasyPermissions.java
public static void goSettingsPermissions(final Object object, int dialogType, final int requestCode, final int requestCodeForResult, boolean isAppDialog) { checkCallingObjectSuitability(object); final Activity activity = getActivity(object); if (null == activity) { return;/*from w w w . j a va 2 s. co m*/ } //appdialog if (isAppDialog == true) { if (object instanceof PermissionWithDialogCallbacks) { ((PermissionWithDialogCallbacks) object).onDialog(requestCode, dialogType, new DialogCallback() { @Override public void onGranted() { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", activity.getPackageName(), null); intent.setData(uri); startForResult(object, intent, requestCodeForResult); } }); } } else { //TODO easypermissiondialog } }
From source file:net.arvin.pictureselectordemo.EasyPermissions.java
public static boolean checkDeniedPermissionsNeverAskAgain(final Object object, String rationale, String positiveButton, String 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; }//w w w . j av a 2s.com 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:pub.devrel.easypermissions.EasyPermission.java
/** * OnActivityResult???/*from w ww. j a v a 2 s . c o m*/ * {@link EasyPermission#hasPermissions(Context, String...)} * * If user denied permissions with the flag NEVER ASK AGAIN, open a dialog explaining the * permissions rationale again and directing the user to the app settings. After the user * returned to the app, {@link Activity#onActivityResult(int, int, Intent)} or * {@link Fragment#onActivityResult(int, int, Intent)} or * {@link android.app.Fragment#onActivityResult(int, int, Intent)} will be called with * {@value #SETTINGS_REQ_CODE} as requestCode * <p> * * NOTE: use of this method is optional, should be called from * {@link PermissionCallback#onPermissionDenied(int, List)} * * @return {@code true} if user denied at least one permission with the flag NEVER ASK AGAIN. */ 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 = Utils.shouldShowRequestPermissionRationale(object, perm); if (!shouldShowRationale) { final Activity activity = Utils.getActivity(object); if (null == activity) { return true; } 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().show(); return true; } } return false; }
From source file:com.felkertech.n.ActivityUtils.java
public static void writeDriveData(final Activity context, GoogleApiClient gapi) { //Ask here for permission to storage PermissionUtils.requestPermissionIfDisabled(context, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, context.getString(R.string.permission_storage_rationale)); if (PermissionUtils.isDisabled(context, android.Manifest.permission_group.STORAGE)) { new MaterialDialog.Builder(context).title(R.string.permission_not_allowed_error) .content(R.string.permission_not_allowed_text).positiveText(R.string.permission_action_settings) .negativeText(R.string.ok).callback(new MaterialDialog.ButtonCallback() { @Override//from www.ja v a 2s. c o m public void onPositive(MaterialDialog dialog) { super.onPositive(dialog); Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", context.getPackageName(), null); intent.setData(uri); } }).build(); } else actuallyWriteData(context, gapi); }
From source file:io.github.marktony.espresso.mvp.addpackage.AddPackageFragment.java
/** * To handle the permission grant result. * If the user denied the permission, show a dialog to explain * the reason why the app need such permission and lead he/her * to the system settings to grant permission. * @param requestCode The request code. See at {@link AddPackageFragment#REQUEST_CAMERA_PERMISSION_CODE} * @param permissions The wanted permissions. * @param grantResults The results./*from w w w . java 2 s.c o m*/ */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode) { case REQUEST_CAMERA_PERMISSION_CODE: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { startScanningActivity(); } else { hideImm(); AlertDialog dialog = new AlertDialog.Builder(getContext()).setTitle(R.string.permission_denied) .setMessage(R.string.require_permission) .setPositiveButton(R.string.go_to_settings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Go to the detail settings of our application Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", getContext().getPackageName(), null); intent.setData(uri); startActivity(intent); dialog.dismiss(); } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); dialog.show(); } break; default: } }
From source file:com.hundsun.yr.mobile.lib.permission.PermissionManager.java
/** * OnActivityResult???// ww w.j av a2 s . co m * {@link PermissionManager#hasPermissions(Context, String...)} * * If user denied permissions with the flag NEVER ASK AGAIN, open a dialog explaining the * permissions rationale again and directing the user to the app settings. After the user * returned to the app, {@link Activity#onActivityResult(int, int, Intent)} or * {@link Fragment#onActivityResult(int, int, Intent)} or * {@link android.app.Fragment#onActivityResult(int, int, Intent)} will be called with * {@value #SETTINGS_REQ_CODE} as requestCode * <p> * * NOTE: use of this method is optional, should be called from * {@link PermissionCallback#onEasyPermissionDenied(int, String[])} * * @return {@code true} if user denied at least one permission with the flag NEVER ASK AGAIN. */ public static boolean checkDeniedPermissionsNeverAskAgain(final Object object, String rationale, @StringRes int positiveButton, @StringRes int negativeButton, @Nullable DialogInterface.OnClickListener negativeButtonOnClickListener, String... deniedPerms) { boolean shouldShowRationale; for (String perm : deniedPerms) { shouldShowRationale = PermissionUtils.shouldShowRequestPermissionRationale(object, perm); if (!shouldShowRationale) { final Activity activity = PermissionUtils.getActivity(object); if (null == activity) { return true; } 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().show(); return true; } } return false; }