I have a Xamarin.Forms app that uses Azure Notification Hub to register and send push notifications. When I looked up the registrations in Server Explorer (Visual Studio), I noticed that there is an Expiration Date of 3 months on all iOS registrations. But the desired behavior is that after a registration has taken place, this registration no longer expires (in other words, expiration date: 31-12-9999 23:59:59)
Is there a way to achieve this for all new registrations? But preferably also on all existing registrations?
The moment someone logs into the app, the following code is executed to register the tag (member id) in the notification hub:
public async void RegisterForNotifications(string tag)
{
// Set the Message listener
MSNotificationHub.SetDelegate(new AzureNotificationHubListener());
// Start the SDK
MSNotificationHub.Start(AppConstants.ListenConnectionString, AppConstants.NotificationHubName);
MSNotificationHub.AddTag(tag);
var template = new MSInstallationTemplate();
template.Body = AppConstants.APNTemplateBody;
MSNotificationHub.SetTemplate(template, key: "template1");
}
I'm using the MSNotificationHub SDK to communicate with the Notification Hub in Azure. I tried to adjust the expiration date using the suggested solution on Stackoverflow. In addition, I made a custom MSInstallationEnrichmentDelegate to set the expiration date to "NSDate.DistantFuture". However, when I try this out, it crashes immediately without showing an exception or logging.
Thanks in advance!