Skip to content

Instantly share code, notes, and snippets.

@LoriBru
Created January 14, 2019 11:51
Show Gist options
  • Select an option

  • Save LoriBru/113f1cd57aa5b304d3a6994935c781ac to your computer and use it in GitHub Desktop.

Select an option

Save LoriBru/113f1cd57aa5b304d3a6994935c781ac to your computer and use it in GitHub Desktop.
Checking app permissions.
private void CheckAppPermissions()
{
if ((int)Build.VERSION.SdkInt < 23)
{
return;
}
else
{
if (Context.CheckSelfPermission(Manifest.Permission.ReadExternalStorage) != Permission.Granted
&& Context.CheckSelfPermission(Manifest.Permission.WriteExternalStorage) != Permission.Granted)
{
var permissions = new string[] { Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage };
RequestPermissions(permissions, 1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment