minafaw3

camera

Nov 16th, 2016
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. private void TryOpenCamera()
  2. {
  3. if((int) Build.VERSION.SdkInt < 23)
  4. {
  5. dispatchTakePictureIntent();
  6. return;
  7. }
  8. GetCameraPermission();
  9. }
  10.  
  11. private void GetCameraPermission()
  12. {
  13. const string permission = Manifest.Permission.WriteExternalStorage;
  14. if (CheckSelfPermission(permission) == (int)Permission.Granted)
  15. {
  16. dispatchTakePictureIntent();
  17. return;
  18. }
  19.  
  20. if (ShouldShowRequestPermissionRationale(permission))
  21. {
  22. //// Explain to the user why we need this permission
  23. //Snackbar.Make(layout, "Camera access is required to take profile ", Snackbar.LengthIndefinite)
  24. // .SetAction("Ok", v => RequestPermissions(CameraPermissions, RequestCameraId))
  25. // .Show();
  26. return;
  27. }
  28. }
Add Comment
Please, Sign In to add comment