AndroidPluginPermission.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using WCQ.CommonV1_20200325;
  6. using UnityEngine.Android;
  7. public class AndroidPluginPermission : AndroidPluginBase
  8. {
  9. private static AndroidPluginPermission Instant;
  10. public static AndroidPluginPermission getInstant {
  11. get {
  12. if(Instant == null) {
  13. Instant = new AndroidPluginPermission();
  14. }
  15. return Instant;
  16. }
  17. }
  18. public AndroidJavaClass AndroidPermissionClass { get; private set; }
  19. public AndroidJavaObject AndroidPermissionObject { get; private set; }
  20. static AndroidJavaClass mUnityPlayerClass = null;
  21. static AndroidJavaObject mCurrentActivity = null;
  22. private AndroidPluginPermission() {
  23. AndroidPermissionClass = GetAndroidJavaClass("com.example.libpermission.PermissionRequest");
  24. AndroidPermissionObject = ClassFunctionCallStatic<AndroidJavaObject>(AndroidPermissionClass, "getInstant", CurrentActivity);
  25. }
  26. public void RequestPermission(string[] permissionList) {
  27. ObjectFunctionCall(AndroidPermissionObject, "RequestPermission", permissionList);
  28. }
  29. }