Check permission method
ContextCompat.checkSelfPermission( context , Permissions to check )
If equal to PackageManager.PERMISSION_GRANTED The representative has authority Otherwise, request permission .

An example of checking permissions is as follows :
ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) = PackageManager.PERMISSION_GRANTED
Request permission method
ActivityCompat.requestPermissions( context , Array of requested permissions , Identifier of the request )
stay onRequestPermissionsResult In the callback method, the requestCode( Is the identifier of the request ) To determine the requested permissions
An example of permission request is as follows
ActivityCompat.requestPermissions(this, new
String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA
}, 10000);

Technology