It really amazes me that a company like Microsoft doesn't give you readable error messages. I'm simply trying to register a device into a notification hub in our azure.
if (App.DeviceInfo.DeviceManufacturer == "Apple")
{
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
else
{
UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
}
}
Register callback
public override void RegisteredForRemoteNotifications(UIApplication app, NSData deviceToken)
{
//// Connection string from your azure dashboard
var cs = WindowsAzure.Messaging.SBConnectionString.CreateListenAccess(
new NSUrl(AzureServiceBusConnectionString),
AzureHubName);
// Register our info with Azure
var hub = new WindowsAzure.Messaging.SBNotificationHub(cs, AzureHubName);
hub.RegisterNativeAsync(deviceToken, null, err =>
{
if (err != null)
{
Console.WriteLine("Error: " + err.Description);
Console.WriteLine(err.DebugDescription);
}
else
Console.WriteLine("Success");
});
}
Here's the error message I get back
Error: Error Domain=WindowsAzureMessaging Code=401 "URLRequest failed for { URL: https://****.servicebus.windows.net/****/Registrations/?$filter=deviceToken+eq+'****'&api-version=2013-04 } with status code: unauthorized" UserInfo={NSLocalizedDescription=URLRequest failed for { URL: https://****.servicebus.windows.net/newsernotificationhub/Registrations/?$filter=deviceToken+eq+'****'&api-version=2013-04 } with status code: unauthorized}
So the only message I get back is unauthorized
, just wondering what some of the reasons why it would come back as unauthorized
when I'm using the endpoint url given in azure, and the notification hub name.
"Failure to deliver notifications may happen during the initial test/staging phase which may indicate a configuration issue or it may happen in production where either all or some of the notifications may be getting dropped indicating some deeper application or messaging pattern issue. "
this deals with diagnosing notifications that didn't get delivered. Nothing to do with my issue. – jdmdevdotnet