check self permission android write external storage

Solutions on MaxInterview for check self permission android write external storage by the best coders in the world

showing results for - "check self permission android write external storage"
Isabella
04 Sep 2020
1private void checkDiskPermission ()
2{
3    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
4        Toast.makeText(this, "No Permissions" , Toast.LENGTH_LONG).show();
5        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
6    }
7    else
8    {
9        Toast.makeText(this, "Has Permissions" , Toast.LENGTH_LONG).show();
10    }
11}