List of usage examples for android.content.pm PackageManager PERMISSION_DENIED
int PERMISSION_DENIED
To view the source code for android.content.pm PackageManager PERMISSION_DENIED.
Click Source Link
From source file:com.team.formal.eyeshopping.MainActivity.java
private boolean hasPermissions(String[] permissions) { int result;// www.j a v a 2 s . c o m //? ? ?? ? ? for (String perms : permissions) { result = ContextCompat.checkSelfPermission(this, perms); if (result == PackageManager.PERMISSION_DENIED) { // ? ? return false; } } // ?? ?? return true; }
From source file:com.tbruyelle.rxpermissions.RxPermissions.java
/** * @param requestCode/*from www.ja va 2 s .c om*/ * @param activity * @param permissions */ void onRequestPermissionsResultFailure(int requestCode, Activity activity, String[] permissions) { int[] grantResults = new int[permissions.length]; boolean[] shouldShowRequestPermissionRationale = new boolean[permissions.length]; for (int i = 0; i < permissions.length; i++) { grantResults[i] = PackageManager.PERMISSION_DENIED; shouldShowRequestPermissionRationale[i] = ActivityCompat.shouldShowRequestPermissionRationale(activity, permissions[i]); } onRequestPermissionsResult(requestCode, permissions, grantResults, shouldShowRequestPermissionRationale); }
From source file:com.ezartech.ezar.videooverlay.ezAR.java
public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException { for (int r : grantResults) { if (r == PackageManager.PERMISSION_DENIED) { this.callbackContext .sendPluginResult(new PluginResult(PluginResult.Status.ERROR, PERMISSION_DENIED_ERROR)); return; }/*from www . java 2 s . com*/ } switch (requestCode) { case CAMERA_SEC: init(null, this.callbackContext); break; } }
From source file:be.ppareit.swiftp.gui.PreferenceFragment.java
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == ACCESS_COARSE_LOCATION_REQUEST_CODE) { if (permissions[0].equals(Manifest.permission.ACCESS_COARSE_LOCATION) && grantResults[0] == PackageManager.PERMISSION_DENIED) { mAutoconnectListPref.getDialog().cancel(); }//from ww w . j a v a 2 s . co m } }
From source file:wanthavers.mad.cs.fau.de.wanthavers_android.desirelist.DesireListFragment.java
@Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults[0] == PackageManager.PERMISSION_DENIED) { showMessage(getString(R.string.declined_location_runtime_permission)); }/*from w w w.j a v a2 s.c o m*/ }
From source file:it_minds.dk.eindberetningmobil_android.views.StartActivity.java
private int checkGPSEnabled() { boolean belowAPI23Check = GpsMonitor.isGpsEnabled(this); if (!belowAPI23Check) { return GPS_DISABLED_GLOBAL_SETTINGS; }// w ww . j a v a2 s. c o m //Needs special check for Marshmallow (6.0+) //Need to check for permissions on runtime if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int fineLocPermissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION); int coarseLocPermissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION); Log.d("DEBUG", "fine = " + fineLocPermissionCheck + " coarse = " + coarseLocPermissionCheck); if (fineLocPermissionCheck == PackageManager.PERMISSION_DENIED || coarseLocPermissionCheck == PackageManager.PERMISSION_DENIED) { return GPS_DISABLED_MARSHMALLOW; } } return GPS_ENABLED; }
From source file:org.irmacard.cardemu.selfenrol.EnrollSelectActivity.java
public void onQRButtonTouch(View v) { if (next_activity == DL_ACTIVITY) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_DENIED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, MainActivity.PERMISSION_REQUEST_CAMERA); } else {// w w w. jav a 2s . c o m startQRScanner(getString(R.string.scan_qr_dl)); } } }
From source file:com.microsoft.aad.adal.CordovaAdalPlugin.java
public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException { for (int r : grantResults) { if (r == PackageManager.PERMISSION_DENIED) { this.callbackContext .sendPluginResult(new PluginResult(PluginResult.Status.ERROR, PERMISSION_DENIED_ERROR)); return; }/*www . j av a 2s. c o m*/ } callbackContext.success(); }
From source file:butter.droid.activities.MainActivity.java
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { switch (requestCode) { case PERMISSIONS_REQUEST: { if (grantResults.length < 1 || grantResults[0] == PackageManager.PERMISSION_DENIED) { finish();//from www. ja v a 2 s .c o m } } } }
From source file:org.awesomeapp.messenger.ui.ConversationDetailActivity.java
void startPhotoTaker() { int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA); if (permissionCheck == PackageManager.PERMISSION_DENIED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { // Show an expanation to the user *asynchronously* -- don't block // this thread waiting for the user's response! After the user // sees the explanation, try again to request the permission. Snackbar.make(mConvoView.getHistoryView(), R.string.grant_perms, Snackbar.LENGTH_LONG).show(); } else {//from ww w. j a v a 2 s. com // No explanation needed, we can request the permission. ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, MY_PERMISSIONS_REQUEST_CAMERA); // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an // app-defined int constant. The callback method gets the // result of the request. } } else { // create Intent to take a picture and return control to the calling application Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File photo = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "cs_" + new Date().getTime() + ".jpg"); mLastPhoto = Uri.fromFile(photo); intent.putExtra(MediaStore.EXTRA_OUTPUT, mLastPhoto); // start the image capture Intent startActivityForResult(intent, ConversationDetailActivity.REQUEST_TAKE_PICTURE); } }