Uygulamam, uygulama kapatıldığında push bildirimlerini iyi alıyor. Ancak uygulama çalışırken, hiçbir şey alamıyorum. Bu, önceki uygulamalarda herhangi bir sorunla karşılaştığım aynı kod, WindowsPhone8'daydı ve yeni uygulamalar WindowsPhone8.1 cihazlarında çalışıyor.Uygulama açık olduğunda PUSH gösterilmiyor
Orijinal uygulamayı yaptığımda bu Push Tutorial'u kullandım. Uygulama açıkken bildirimleri almak istiyorsanız, bunu ekleyen satır var.
Eğer 8.1 güncellemesi, bilmek güzel olan push bildirimlerine bir şey yapmıştır. Başka bir şey de takdir edilecektir.
HttpNotificationChannel pushChannel;
string channelName = "PushChannel";
pushChannel = HttpNotificationChannel.Find(channelName);
//Push Notifications
if (pushChannel == null)
{
pushChannel = new HttpNotificationChannel(channelName);
//// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated +=
new EventHandler<NotificationChannelUriEventArgs>(
PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred +=
new EventHandler<NotificationChannelErrorEventArgs>(
PushChannel_ErrorOccurred);
// Register for this notification only if you need to receive
// the notifications while your application is running.
pushChannel.ShellToastNotificationReceived +=
new EventHandler<NotificationEventArgs>(
PushChannel_ShellToastNotificationReceived);
pushChannel.Open();
// Bind this new channel for toast events.
pushChannel.BindToShellToast();
}
else...
void PushChannel_ShellToastNotificationReceived(object sender,
NotificationEventArgs e)
{
string relativeUri = string.Empty;
// Parse out the information that was part of the message.
foreach (string key in e.Collection.Keys)
{
if (string.Compare(
key,
"wp:Param",
System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.CompareOptions.IgnoreCase) == 0)
{
relativeUri = e.Collection[key];
}
}
}
Lütfen bir kod gösterin. MPNS veya WNS kullanıyor musunuz? – Fred
Kod eklendi. Diğerleri, olay işleyicilerini zaten varolan PushChannel'e eklemeye gider. – Seige
Özetle, ShellToastNotificationReceived çalışmıyor. Öyle değil mi? – fillobotto