Exemplo n.º 1
0
        // Retrieve the SDK version number of the device.], from the API.
        public int GetSdkVersion()
        {
            if (Granter == null)
            {
                Granter = new PermissionGranterProxy();
            }

            return(Granter.GetSdkVersion());
        }
Exemplo n.º 2
0
        // Runtime permission granting is only accesible from devices with API 23 and up.
        // You should already be performing this check on your own.
        public bool IsCompatible()
        {
            if (Granter == null)
            {
                Granter = new PermissionGranterProxy();
            }

            var versionNumber = Granter.GetSdkVersion();

            return(versionNumber >= 23);
        }
Exemplo n.º 3
0
        // Request a permission of requestCode
        public void RequestPermission(int requestCode)
        {
            if (!IsCompatible())
            {
                return;
            }

            if (Granter == null)
            {
                Granter = new PermissionGranterProxy();
            }

            Granter.RequestPermission(requestCode);
        }
Exemplo n.º 4
0
        // Check a permission status of requestCode
        public bool CheckPermissions(int requestCode)
        {
            if (!IsCompatible())
            {
                return(false);
            }

            if (Granter == null)
            {
                Granter = new PermissionGranterProxy();
            }

            return(Granter.CheckForPermission(requestCode));
        }