I have a C# WPF application that connects to an Azure hosted API. When the API has detected specific events inside the data base it updates the WPF app to show the events and they are alerted to the user on the desktop using Toast Alerts.
The code that creates the Toast is as follows :-
public static async Task ShowEventNotification(EventList n)
{
API.EventRaised(n);
var toast = new ToastContentBuilder();
toast
.AddArgument("Type", "Event")
.AddArgument("EventID", n.EventID)
.AddText(n.EventName.ToString())
.AddText("")
.AddText(n.EventText.ToString());
foreach (EventAnswerList na in n.Answers)
{
toast.AddButton(new ToastButton()
.SetContent(na.AnswerText)
.AddArgument("action", "Answer"))
.AddArgument("ansID", na.AnswerID);
}
toast.AddButton(new ToastButton()
.SetContent("Open Event")
.AddArgument("action", "OpenEvent"));
toast.Show();
}
All of the above works great, we have run in debug and everything is fine, we have created Release code and it works fine.
The company we are working with wants to publish this via MSIX package so we have added a Windows Application Packaging Project to the solution and done the basic configuration and run the build and everything is great. The Package is as per the below :-
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
IgnorableNamespaces="uap rescap uap3">
<Identity
Name="3666be11-7f9a-4526-914c-b0aaf423c1c1"
Publisher="CN=Company Name"
Version="1.0.13.0" />
<Properties>
<DisplayName>Application Name</DisplayName>
<PublisherDisplayName>Company Name</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="Application Name"
Description="Generic Description"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" Square71x71Logo="Images\SmallTile.png" Square310x310Logo="Images\LargeTile.png" ShortName="Application">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo"/>
<uap:ShowOn Tile="wide310x150Logo"/>
<uap:ShowOn Tile="square310x310Logo"/>
</uap:ShowNameOnTiles>
</uap:DefaultTile >
<uap:SplashScreen Image="Images\SplashScreen.png" />
<uap:LockScreen Notification="badgeAndTileText" BadgeLogo="Images\BadgeLogo.png"/>
</uap:VisualElements>
<Extensions>
<!--Specify which CLSID to activate when toast clicked-->
<desktop:Extension Category="windows.toastNotificationActivation">
<desktop:ToastNotificationActivation ToastActivatorCLSID="AF58DFB8-74A0-4433-836C-8A3BD0B333B5" />
</desktop:Extension>
<!--Register COM CLSID LocalServer32 registry key-->
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:ExeServer Executable="ProjectName\ProjectName.exe" Arguments="-ToastActivated" DisplayName="Toast activator">
<com:Class Id="AF58DFB8-74A0-4433-836C-8A3BD0B333B5" DisplayName="Toast activator"/>
</com:ExeServer>
</com:ComServer>
</com:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
Now everything installs fine and the app runs without issues other than one. Toast notifications don't show. There are no errors raised nothing in the windows logs and we know that the code is running as the call to API.EventRaised(n) in the function works and the API receives a report to show the Event has been raised and logs it into the database.
I have searched all over and all the advice I can find says that an MSIX installer should just work when creating Toast notifications, but I will admit to being new to MSIX deployments so am probably missing something very basic in the install package.
Can anyone point me in the right direction to resolve this issue?
Thanks in advance.
Edit : have updated the package slightly after reviewing the below link, still not got any notifications showing. https://docstaging.z5.web.core.windows.net/aleader/toolkit-7/design/shell/tiles-and-notifications/send-local-toast.html?tabs=uwp