トースト通知引数を送信して、Webブラウザーを開く必要があります。これが私のコードです:
private void DoNotification()
{
var notifications = serviceClient.GetNotificationsAsync(App.CurrentRestaurantLocation.ID);
foreach (RestaurantNotification note in notifications.Result)
{
IToastNotificationContent toastContent = null;
IToastText02 templateContent = ToastContentFactory.CreateToastText02();
templateContent.TextHeading.Text = note.Title;
templateContent.TextBodyWrap.Text = note.Message;
toastContent = templateContent;
// Create a toast, then create a ToastNotifier object to show
// the toast
ToastNotification toast = toastContent.CreateNotification();
toast.Activated += toast_Activated;
// If you have other applications in your package, you can specify the AppId of
// the app to create a ToastNotifier for that application
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
}
async void toast_Activated(ToastNotification sender, object args)
{
await Launcher.LaunchUriAsync(new Uri("http://www.google.com"));
}
アクティブ化されたイベントが発生しましたが、Webブラウザが開きません。そのランチャーコードは、トースト通知なしで機能します。
argsにURLを入力するにはどうすればよいですか?私のWebサービスはnote.RedirectUrlを返し、そこにフィードしたいと思います。