Articles → Android → Permissions in android

Permissions in android






Why permission?





Categories of permission











Implementation






<uses-permission android:name="android.permission.CAMERA" />






if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA)
   != PackageManager.PERMISSION_GRANTED) {

   ActivityCompat.requestPermissions(MainActivity.this,
           new String[]{Manifest.permission.CAMERA},1);
}



Setting the app permission















Click to Enlarge


Output





Click to Enlarge


Call back method for permissions




@Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
          super.onRequestPermissionsResult(requestCode, permissions, grantResults);}



Posted By  -  Karan Gupta
 
Posted On  -  Sunday, December 15, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250