【问题标题】:Why Package.Appxmanifest is not found in Visual Studio 2012 for Windows Phone Express?为什么在 Visual Studio 2012 for Windows Phone Express 中找不到 Package.Appxmanifest?
【发布时间】:2014-03-09 07:04:12
【问题描述】:

我是 Windows Phone 8 开发的新手。我想展示Toast notifiation 和it is suggested that I need to change in Package.Appxmanifest file。我使用 C# 作为语言。

我正在使用VS2012 Express for Windows Phone。 WMAppManifest.xml 和 AppManifest.xml 由 Visual Studio 向导创建,但我找不到 Package.Appxmanifest。

请建议是否有任何其他方式显示 toast 通知。

显示 toast 的代码:

string toast = "This is toast";
ShellToast t = new ShellToast();
t.Title = "Non null";
t.Content = toast;
t.Show();

【问题讨论】:

  • 值得指出的是,链接的答案适用于 Windows 8/RT(而不是 Windows Phone 8)的 Windows Store Apps;关于发送Toasts for Windows Phone on MSDN 有很好的文档
  • +1。谢谢。我将通过建议的链接。
  • @rockstartprogrammer 我已经编辑了答案,现在我看到了你想要做什么。您应该编辑问题的标题,因为它与问题没有任何关系。

标签: c# visual-studio visual-studio-2012 windows-phone-8 notifications


【解决方案1】:

编辑:

好的,现在我看到您正在尝试创建并显示 local toast notification。关键是当应用程序处于前台时,您无法显示 toast 通知。当您的应用不在前台时,它们可以通过Background Agent 显示。您的代码没问题,但它应该放在Background Agent 中。

如果您仍想在应用中显示 toast 通知,可以使用 Coding4Fun toolkit 中的 ToastPrompt 控件来实现:

ToastPrompt toast = new ToastPrompt();
toast.Title = "Title";
toast.Message = "message";
toast.ImageSource = new BitmapImage(new Uri("ImageUri", UriKind.RelativeOrAbsolute));
toast.Show();

您链接的帖子是关于 Windows 应用商店 应用的。

对于 Windows Phone 应用,您需要检查 WMAppManifest.xml 文件中的ID_CAP_PUSH_NOTIFICATION 功能:

【讨论】:

  • 经过大量调试后,我保留了所有功能。问题还是一样。
  • 问题出在哪里?
  • 我第一次尝试在ID_CAP_PUSH_NOTIFICATION 上,但没有用。
  • 但是“不起作用”是什么意思。你想做什么?到目前为止你做了什么?
  • 您知道普通应用无法随机显示 Toast 通知吗?只有后台任务可以显示来自代码的 toast 通知。如果您的应用处于活动状态,也不会显示推送通知
猜你喜欢
  • 2013-07-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-23
  • 1970-01-01
  • 1970-01-01
  • 2017-06-22
  • 2013-10-29
相关资源
最近更新 更多