unity-获取安卓权限

2020-05-20  本文已影响0人  風华绝世

string[] strs = new string[] { "android.permission.WRITE_EXTERNAL_STORAGE" //"android.permission.READ_EXTERNAL_STORAGE" //"android.permission.INTERNET", //"android.permission.READ_PHONE_STATE", //"android.permission.READ_EXTERNAL_STORAGE", //"android.permission.WRITE_EXTERNAL_STORAGE", //"android.permission.ACCESS_WIFI_STATE", //"android.permission.ACCESS_NETWORK_STATE", //"android.permission.GET_TASKS", //"android.permission.REQUEST_INSTALL_PACKAGES", //"android.permission.WAKE_LOCK", //"android.permission.SYSTEM_ALERT_WINDOW", //"android.permission.CHANGE_WIFI_STATE", //"android.permission.CHANGE_NETWORK_STATE", //"android.permission.ACCESS_COARSE_LOCATION", //"android.permission.ACCESS_FINE_LOCATION", //"android.permission.SYSTEM_OVERLAY_WINDOW", //"android.permission.ACCESS_COARSE_UPDATES", //"android.permission.WRITE_SETTINGS", //"android.permission.BATTERY_STATS", //"android.permission.MOUNT_UNMOUNT_FILESYSTEMS" };

public void test4() { strs.ToList().ForEach(s => { if (!Permission.HasUserAuthorizedPermission(s)) { Permission.RequestUserPermission(s); } else { Debug.Log("it has RequestUserPermission: " + s); } }); }

上一篇下一篇

猜你喜欢

热点阅读