Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot set "User Notification Listener" capablity in visual studio for UWP app

I'm trying to follow this guide on setting up a notification listener in a unified windows platform (UWP) application. I've got the example code running up until listener.RequestAccessAsync is called, but it keeps returning UserNotificationListenerAccessStatus.Denied without asking me to allow the application to access that information (it also never asked me before and I cannot find the app in ms-settings:privacy-notifications.

I've tried to set the capabilities of the app to allow "User Notification Listener" like it says in the first paragraph of the above mentioned page, but that does not appear in the list of available capability settings in my Package.appxmanifest. The target and minimal supported version for the project solution is 16299.

Is there a way to make this work or has this broken since this feature was added in windows build 14393?

like image 797
Lejar Avatar asked Nov 25 '17 11:11

Lejar


1 Answers

You'll need to manually add this capability to the manifest. Right-click on the Package.appxmanifest in the 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>
like image 51
A. Milto Avatar answered Nov 05 '22 21:11

A. Milto