C
C#11mo ago
Gonzaliito

Someone know how can I listen third party notifications in Windows 10?

I saw this documentacion https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/notification-listener but still don't know how to use it. My code:
C#
// Get the listener
using Windows.UI.Notifications.Management;
using Windows.UI.Notifications;
using Windows.Foundation.Metadata;

internal class Program
{
private static void Main(string[] args)
{
if (ApiInformation.IsTypePresent("Windows.UI.Notifications.Management.UserNotificationListener"))
{
// Listener supported!
// Get the listener
Console.WriteLine("Yep");
UserNotificationListener listener = UserNotificationListener.Current;
UserNotificationListenerAccessStatus accessStatus = await listener.RequestAccessAsync();

switch (accessStatus)
{

case UserNotificationListenerAccessStatus.Allowed:

// Yay! Proceed as normal
break;

case UserNotificationListenerAccessStatus.Denied:

break;
case UserNotificationListenerAccessStatus.Unspecified:
break;
}
}

else
{
Console.WriteLine("Nop");
}
}
}
C#
// Get the listener
using Windows.UI.Notifications.Management;
using Windows.UI.Notifications;
using Windows.Foundation.Metadata;

internal class Program
{
private static void Main(string[] args)
{
if (ApiInformation.IsTypePresent("Windows.UI.Notifications.Management.UserNotificationListener"))
{
// Listener supported!
// Get the listener
Console.WriteLine("Yep");
UserNotificationListener listener = UserNotificationListener.Current;
UserNotificationListenerAccessStatus accessStatus = await listener.RequestAccessAsync();

switch (accessStatus)
{

case UserNotificationListenerAccessStatus.Allowed:

// Yay! Proceed as normal
break;

case UserNotificationListenerAccessStatus.Denied:

break;
case UserNotificationListenerAccessStatus.Unspecified:
break;
}
}

else
{
Console.WriteLine("Nop");
}
}
}
Notification listener - Windows apps
Learn how to use Notification Listener to access all of the user's notifications.
No description
1 Reply
Gonzaliito
GonzaliitoOP11mo ago
Also when I compile the code, this execute "Nop" but my windows 10 has activate notifications
Want results from more Discord servers?
Add your server