एप्लिकेशन बंद होने पर मेरा एप्लिकेशन पुश नोटिफिकेशन अच्छी तरह से प्राप्त करता है। लेकिन जब ऐप चल रहा है, मुझे कुछ भी नहीं मिला। यह वही कोड है जिसे मैंने पिछले ऐप्स में किसी भी समस्या के साथ उपयोग किया है, वे WindowsPhone8 पर थे और नए ऐप्स WindowsPhone8.1 डिवाइस पर चल रहे हैं।ऐप खुला होने पर PUSH नहीं दिखा रहा है
जब मैंने मूल ऐप बनाया था तो मैंने Push Tutorial का उपयोग किया था। मेरे पास वह लाइन है जो कहती है कि यदि आप ऐप खुले हैं तो नोटिफिकेशन प्राप्त करना चाहते हैं।
यदि 8.1 अपडेट ने पुश अधिसूचनाओं के लिए कुछ किया है जो जानना अच्छा होगा। और कुछ भी सराहना की जाएगी।
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];
}
}
}
कृपया कुछ कोड दिखाएं। क्या आप एमपीएनएस या डब्ल्यूएनएस का उपयोग कर रहे हैं? – Fred
कोड जोड़ा गया। अन्यथा ईवेंट हैंडलर को पहले से मौजूद पुशचैनल में जोड़ना है। – Seige
संक्षेप में, ShellToastNotificationReceived फायरिंग नहीं है। यही है ना – fillobotto