I'm trying to send notification to iOS and Android devices through a Mac App made with Xamarin.Mac. I've the following code:
notif_button.Activated += (sender, e) => {
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString("<connection string>", "<hub name>");
String pushMessage = "{ \"data\" : {\"msg\":\"" + Message + "\",\"param\":\"" + parameter + "\"}}";
NotificationOutcome result = await hub.SendGcmNativeNotificationAsync(pushMessage);
};
The problem is that NotificationHubClient is not recognised. Anyone know why ? I tried to add "using Microsoft.Azure..." without success.
You need to change the
Target Framework
of your Xamarin.Mac project toXamarin.Mac Full
vs. the default ofXamarin.Mac Modern
Once you do that, you can retarget the packages to that framework:
Now the
Microsoft.Azure.NotifactionHub
reference will show up under the package references:Add a
using
clause of:Now you can access the
NotificationHubClient
class: