I have an application for Windows phone 8.1 silverlight where I want to receive Notfications using the new WNS framework.
I have package.appxmanifest: <identity name="4657xxxxxxx" publisher="CN=xxxxx" version="1.0.0.0"/> and added it to the mobile services hub.
To do this, I removed the old links for using MPNS and added the following for WNS:
using Windows.UI.Notifications;
using Windows.Networking.PushNotifications;
using Windows.UI.StartScreen;
This led to a new way to get the URI channel:
public static PushNotificationChannel CurrentChannel { get; private set; } public async static Task<bool> UploadChannel() { bool newChannel = false; var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var settings = Windows.Storage.ApplicationData.Current.LocalSettings.Values; object oldChannel; settings.TryGetValue("channelURI", out oldChannel); if ((oldChannel as PushNotificationChannel).Uri != CurrentChannel.Uri) { settings.Add("channelURI", CurrentChannel); newChannel = true; } try { await App.MobileService.GetPush().RegisterNativeAsync(channel.Uri); } catch (Exception exception) { CurrentChannel.Close(); HandleRegisterException(exception); } CurrentChannel.PushNotificationReceived += CurrentChannel_PushNotificationReceived; return newChannel; } private static void HandleRegisterException(Exception exception) { MessageBox.Show("error - retry pushchannel"); }
In addition, I deleted ID_CAP_PushNotification based on Microsoftsoft update information. I do not receive the channel, I receive an error message:
The app does not have cloud notification capabilities. (Exception from HRESULT: 0x803E0110)
Solution I searched for an error and found this link . This can be resolved as indicated in the answer below by contacting package.appxmanifest and turning on the Internet (Client and Server)).
ERROR 2 Then the UploadChannel() function should work. However, the register API call await App.MobileService.GetPush().RegisterNativeAsync(channel.Uri); leads to an error on the server:
Message = 'Failed to register on mpns platform. Received error: "Unsupported uri channel: https : //db3.notify.windows.com .,.
The error makes sense, but I have no idea how to solve it.
Ekstra On the server, I can subscribe with a URI and receive notifications. But not on the client. Is this how it should be or?