PermissionHelper.cs 789 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. #if(UNITY_2018_3_OR_NEWER && UNITY_ANDROID)
  5. using UnityEngine.Android;
  6. #endif
  7. namespace Agora.Util
  8. {
  9. public class PermissionHelper
  10. {
  11. public static void RequestMicrophontPermission()
  12. {
  13. #if (UNITY_2018_3_OR_NEWER && UNITY_ANDROID)
  14. if (!Permission.HasUserAuthorizedPermission(Permission.Microphone))
  15. {
  16. Permission.RequestUserPermission(Permission.Microphone);
  17. }
  18. #endif
  19. }
  20. public static void RequestCameraPermission()
  21. {
  22. #if (UNITY_2018_3_OR_NEWER && UNITY_ANDROID)
  23. if (!Permission.HasUserAuthorizedPermission(Permission.Camera))
  24. {
  25. Permission.RequestUserPermission(Permission.Camera);
  26. }
  27. #endif
  28. }
  29. }
  30. }