In my Package.appxmanifest I have declared broadFileSystemAccess
capability.
In the code I have a try...catch statement for testing state of the File access toggle:
try
{
var app1Folder = await StorageFolder.GetFolderFromPathAsync(@"C:\Users\krist\AppData\Local\Packages\9db24c29-1e69-4305-b62a-bcff344d6d41_915j3m6y7acyw");
}
catch (Exception ex)
{
// prompt user for what action they should do then launch below
// suggestion could be a message prompt
var success = await Launcher.LaunchUriAsync(new Uri("ms-settings:appsfeatures-app"));
}
In the blog post that concerns this broadFileSystemAccess
it is stated:
Just like other privacy issues, the app will trigger a user-consent prompt on first use.
What I have tested and seen, there is no user-consent prompt at all. Every article or SO answer states that I need to navigate to the Settings (or App settings) page of the app where the user needs to toggle "File system" switch.
However, from user perspective it would be convenient to answer simple "Yes/No" dialog and give that permission right from the app and continue execution with the new setting.
Is there any way how to trigger that user-consent dialog?
Is there any way how to trigger that user-consent dialog?
No, it doesn't appear since the October 2018 release of Windows 10. What you should do since then is to prompt the user to change the setting himself/herself in the Setting app, just like you are currently doing.
Please refer to Andrew Whitechapel's answer here for more information.