我想知道如何在 UWP 应用中设置 Toast 功能。我正在使用 Visual Studio 2015 并且在 Package.appxmanifest 编辑器中没有任何选项。我试图手动编辑 xml,msdn 说你可以像那样手动添加。
<VisualElements
...
ToastCapable="true">
</VisualElements>
但我发现 .appxmenifest 就是这样
<uap:VisualElements DisplayName="Name" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Sample" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" ShortName="Name">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
<uap:InitialRotationPreference>
<uap:Rotation Preference="portrait" />
<uap:Rotation Preference="landscape" />
<uap:Rotation Preference="portraitFlipped" />
<uap:Rotation Preference="landscapeFlipped" />
</uap:InitialRotationPreference>
</uap:VisualElements>
如何实现 toast 能力?请帮忙。
最佳答案
在 Windows 10 中,您不再需要设置 ToastCapable 标志:
Hmm, well you definitely need to have ToastCapable set to true in the manifest since 8.1 required that, otherwise your toasts won’t work in 8.1 (in 10, we stopped requiring the ToastCapable flag).
来源:Comment on the official Quickstart guide
您可以在 full source code 中自行验证GitHub 上的快速入门。
关于visual-studio-2015 - 如何在 Windows 10 应用程序中设置 Toast Capable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38463088/