NathanaelA / nativescript-permissions

Wraps up the entire Android 6 permissions system in a easy to use plugin.
MIT License
46 stars 22 forks source link

Unable to request 'android.permission.BIND_DEVICE_ADMIN' #36

Closed DeadEnglish closed 5 years ago

DeadEnglish commented 5 years ago

I have android.permission.BIND_DEVICE_ADMIN within my AndroidManifest.xml as per my other permissions but currently I'm unable to request permission for it. There's no "toast" notification to accept/deny as with the other permissions.

The request permissions code is as follows

requestPermission(android.Manifest.permission.BIND_DEVICE_ADMIN, 'needed for kiosk mode').then(function () {
                console.log("permission for BIND_DEVICE_ADMIN");
            })
            .catch(function () {
                console.log("no perms for BIND_DEVICE_ADMIN");
            });
NathanaelA commented 5 years ago

Do you get anything at all?
Does the promise resolve or reject? What happens if you add:
console.log("Bind:", android.Manifest.permission.BIND_DEVICE_ADMIN); Does it actually print a value out?

DeadEnglish commented 5 years ago

The promise is rejected and caught within the .catch. Console logging console.log("Bind:", android.Manifest.permission.BIND_DEVICE_ADMIN); returns the following:

Bind: android.permission.BIND_DEVICE_ADMIN

console logging the return within the .catch adding promise within the .catch function parameters returns the following also:

promise {
    "android.permission.BIND_DEVICE_ADMIN": false
}
NathanaelA commented 5 years ago

Do you have this permission and a receiver in your manifest file?

https://developer.android.com/guide/topics/admin/device-admin

DeadEnglish commented 5 years ago

I did have both but it seems like 'BIND_DEVICE_ADMIN' isn't accessible at all through the application, it seems to be required when setting the device admin. Closing as this isn't an issue with the plugin, just unclear instructions when using kiosk mode in nativescript.