I'm attempting to configure my app to use WNS instead of MPNS (I am using Xamarin Forms and have a Win Phone 8.1 Silverlight project with an Azure Notification hub for the back end), for that I updated my code to use the the mobile service to register the phone for push notifications and changed the Notification Service in the WMAppManifest.xml to WNS. After implementing these changes when I check the phones registration through azure it says its MPNS. Below are some screen captures of my configuration and code snippets of how im registering the app.
WMAppManifest.xml
Package.appxmanifest
NotificationManager Code
public class PushNotificationManager : IPushNotificationManager
{
private PushNotificationChannel channel;
public PushNotificationManager() { }
public static MobileServiceClient MobileService = new MobileServiceClient(Utilities.Constants.ApplicationURL, Utilities.Constants.ApplicationKey);
public async Task RegisterDevice()
{
try
{
channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
channel.PushNotificationReceived += Channel_PushNotificationReceived;
await this.RegisterWinDevice(channel.Uri);
NotificationTask.UnregisterBackgroundTask();
NotificationTask.RegisterBackgroundTask();
}
catch (Exception ex)
{
throw ex;
}
}
protected void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
{
try
{
//Create notification
}
catch (Exception ex)
{
throw ex;
}
}
public async Task UnregisterDevice()
{
if(channel != null)
{
channel.Close();
}
await MobileService.GetPush().UnregisterNativeAsync();
}
private async Task RegisterWinDevice(string channelUri)
{
try
{
var tags = new List<string>() { };
User user = LocalStorage.GetUserInfo();
tags.Add(user.Id.ToString());
await MobileService.GetPush().RegisterNativeAsync(channelUri, tags.ToArray());
}
catch (Exception ex)
{
throw ex;
}
}
private void CreateNotification(string title, string message)
{
//Show Toast
}
}
In azure I have set the windows Package SID and client secret. I also have unauthenticated push notifications enabled (Although from my understanding this is for MPNS).
And finally here's a screen capture of how it registers with the following code:
If anyone has any idea how to get it to properly register to WNS I'd greatly appreciate the help. Thanks!