This is the code for asking permisson when the function is called.
public void sendMessage(View view) {
        if(Build.VERSION.SDK_INT <23 || checkSelfPermission(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED){
            Toast.makeText(this,"Permission has granted, very nice.",Toast.LENGTH_SHORT).show();
        }
        else{
            if(!shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)){
                Toast.makeText(this,"This permission is required for this action, what a pitty.",Toast.LENGTH_SHORT).show();
            }
            else{
                requestPermissions(new String[]{Manifest.permission.CAMERA},100);
                Toast.makeText(this,"If you wanna do that, you have to give permission.",Toast.LENGTH_SHORT).show();
            }
        }
    }`
And this is the AndroidManifest.xml
    <uses-permission android:name="android.permission.CAMERA" />
Question is that.
In that case, at SDK 21 -> it will ask permission when installing app. at SDK 25 -> it won't ask permission when installing but when function has called
is that structure is correct?
                        
// Check permission like this
After permission granted