write_external_storage permission android code example

Example 1: ios permission info.plist

File: Info.plist

Camera

<key>NSCameraUsageDescription</key>
<string>camera description.</string>
Photos

<key>NSPhotoLibraryUsageDescription</key>
<string> photos description.</string>
Save Photos

  <key>NSPhotoLibraryAddUsageDescription</key>
  <string> photos add description.</string>
Location

<key> NSLocationWhenInUseUsageDescription</key>
<string> location description.</string>
Apple Music:

<key>NSAppleMusicUsageDescription</key>
<string>My description about why I need this capability</string>
Calendar

<key>NSCalendarsUsageDescription</key>
<string>My description about why I need this capability</string>
Siri

<key>NSSiriUsageDescription</key>
<string>My description about why I need this capability</string>

Example 2: check self permission android write_external_storage

private void checkDiskPermission ()
{
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        Toast.makeText(this, "No Permissions" , Toast.LENGTH_LONG).show();
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
    }
    else
    {
        Toast.makeText(this, "Has Permissions" , Toast.LENGTH_LONG).show();
    }
}

Tags:

Misc Example