Send a Push Notification from Business Central to IOS devices by using Azure Notification Hub and a Xamarin Form app.


  • In Business central we have a “Messages” table where there are messages to be dispatched to mobile devices;
  • In the Business Central we have a page where the user sends a push notification to the sales agents;
  • The sales agents receive the Push Notification containing the message in the IOS App;



  • A simple Xamarin Forms app;
  • An Azure Function;
  • An Azure Notification Hub account;
  • An Apple Push certificate;
  • A Business Central Extension;
  • In this sample I am not using Azure Vault to store passwords and I just use settings.json, you should when in production environment 🙂


The Xamarin Forms sources are available from GitHub:

The Xamarin Forms project is a simple single page app that just register and waits for a push notification.

The Xamarin Forms basically consists in three functions and all of then are in the AppDelegate.cs file.

Firstly the app registers itself to the Apple Notification Service managing the different ways to implement it in various IOS version (right now I use it with IOS 14.X, this part will change with next version of IOS so just have a look at github source for updates) .

Secondly the app registers itself to Microsoft Notification Hub.

ProcessNotification is the function that manage the push notification behaviour.

The Azure Hub Notification endpoints have to be configured in AzureNotificationConstants.cs


The Xamarin Forms sources are available from GitHub:

The Azure Function is pretty simple too. It wait for a GET request with the message as a query parameter. When it is called it dispatch the message by using NotificationHubClient.


The Business Central extension sources are available from GitHub:

The extension consists in very simple table with a page card and a page list that allow CRUD for records.

The codeunit “Cod70359948.ALV Send Push” contains the SendPush function that calls the Azure Function to send the messages.


This tutorial does not cover the configuration and setup-up of Apple Push Certificates, it is a very long and exhausting procedure far away from being summarised in a short tutorial. So I give it for granted that you are familiar with this part.

Supposing you have already your app development ad production certificates and profiles, then this tutorial cover how to use them in Microsoft Notification Hub.

All you have to do is to access your Apple Membership and to go to Keys section.

There add a new Key, digit the key name and enable the “Apple Push Notification service” checkbok.

Then download the P8 file, the file name will be {your_key_id}.p8 (in my case it is AuthKey_TAYAGJ3W48.p8). SAVE THE P8 file. You should never delete it.

Go back to your apple membership page and note your “Team ID“.

Then you go to Identifiers page and there you note your app identifier name.


In Azure Portal, you create are resource “Notification Hub”.

Create the resource group, insert your namespace and hub name.

Wait Azure completes the creation of the resource, then edit the notification hub just created and go to “Settings” -> “Apple APNS” section. There just select the “Token” Authentication Mode, then you have to copy the key_id, the bundle_id and the key_id as they were noted in the Apple section.

Now open, with a text editor, the P8 file you have previously downloaded. Copy the key without the “—–BEGIN PRIVATE KEY—–” and “—–END PRIVATE KEY—–” placeholders and paste it in the “Token” field.

Save , then go to “Manage” -> “Access Policies” section and copy the Connection string with Listen Permission.


In your Xamarin Forms solution, open AzureNotificationConstants.cs and copy the ListenConnectionString and the hub name.

Open Azure Function in Visual Studio Code, edit the “local.settings.json” file and copy the connection string and HubName here too.


This solution send broadcast messages, I will publish soon a complete solution where it is possibile to send a message to a specific user.


13th April 2020

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s