Unable to set "User Notification Listener" feature in visual studio for UWP application

I am trying to follow this guide to setting up a notification listener in a Unified Windows Platform (UWP) application. I have an example code that works until it is called listener.RequestAccessAsync, but it will return UserNotificationListenerAccessStatus.Deniedwithout asking for permission to access this information (it also never asked me before, and I can not find the application in ms-settings:privacy-notifications>.

I tried to set the capabilities of the application to enable the "User Notification Listener", as it says in the first paragraph of the above page, but this does not appear in the list of available feature options in mine Package.appxmanifest. The target and minimum supported version for the project solution is 16299.

Is there any way to make this work or it broke, since this function was added in windows build 14393?

+4
source share
1 answer

You will need to manually add this feature to the manifest. Right-click on Package.appxmanifest in Solution Explorer and select View Code. Make the following changes to the file:

<Package ...
     xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"  
     IgnorableNamespaces="... uap3">
     ...
     <Capabilities>
          ...
          <uap3:Capability Name="userNotificationListener"/>  
     </Capabilities>
</Package>
+5
source

Source: https://habr.com/ru/post/1689816/


All Articles