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?
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With