Last active
April 11, 2020 17:02
-
-
Save ashishkudale/7e3583c1c46a231c844b8d2655488bd7 to your computer and use it in GitHub Desktop.
check permission and request permission
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add this line in import section | |
import static android.Manifest.permission.CAMERA; | |
private void requestPermission() { | |
ActivityCompat.requestPermissions(this, new String[]{CAMERA}, PERMISSION_REQUEST_CODE); | |
} | |
private boolean checkPermission() { | |
return ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA) == PackageManager.PERMISSION_GRANTED; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment