NGPermissionCallbackAndroid.cs 584 B

1234567891011121314151617181920212223242526272829
  1. #if UNITY_EDITOR || UNITY_ANDROID
  2. using System.Threading;
  3. using UnityEngine;
  4. namespace NativeGalleryNamespace
  5. {
  6. public class NGPermissionCallbackAndroid : AndroidJavaProxy
  7. {
  8. private object threadLock;
  9. public int Result { get; private set; }
  10. public NGPermissionCallbackAndroid( object threadLock ) : base( "com.yasirkula.unity.NativeGalleryPermissionReceiver" )
  11. {
  12. Result = -1;
  13. this.threadLock = threadLock;
  14. }
  15. public void OnPermissionResult( int result )
  16. {
  17. Result = result;
  18. lock( threadLock )
  19. {
  20. Monitor.Pulse( threadLock );
  21. }
  22. }
  23. }
  24. }
  25. #endif