azure CreateNotificationHub with Sandbox programmatically

231 views Asked by At

I have to create a notificationhub programmatically with Sandbox mode for iOS devices(for development and testing). Not sure how to configure that. Below is the code I am using for creating the hub

                NotificationHubDescription notificationHubDescription = new NotificationHubDescription(hubName);
            notificationHubDescription.ApnsCredential = new ApnsCredential(certificateFile, certificatePassword);

            if (!namespaceManager.NotificationHubExists(hubName))
            {
                notificationHubDesc = namespaceManager.CreateNotificationHub(notificationHubDescription);
            }
1

There are 1 answers

0
Ankit On BEST ANSWER

Got solution - Need to set following in the code. Weird that this is not mentioned in the document by Azure

                if (!isForProduction)
                apns.Endpoint = "gateway.sandbox.push.apple.com";