UWP Control panel app settings

Multi tool use


UWP Control panel app settings
If i declared a permission in application manifest(eg. microphone) is there a way to check if the user has enabled this permission and to change permission if user agrees to have permission changed?
This is for a UWP application written in C# to allow cortana to interact with application
1 Answer
1
Is there a way to check if the user has enabled this permission?
Call MediaCapture.InitializeAsync method in a try-catch block, specify you want to initialize microphone in the MediaCaptureInitializationSettings
parameter. If it is the first time use of this API, it will launch a consent prompt to get the user's permission for the app to access the microphone. If user has already refused to grant permission, you get an exception.
MediaCaptureInitializationSettings
Can I Change permission if user agrees to have permission changed?
No. It is the user that takes full control over this, there is no API to change the permission. Just imagine how many apps will secretly grant themselves access without user's consent if such API exists.
However, when detecting the permission is somehow turned off, you can launch the Settings
app to the Privacy -> Microphone
page so user can easily grant the permission there. Again, user takes full control over this.
Settings
Privacy -> Microphone
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-microphone"));
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.