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 Frameworkof your Xamarin.Mac project toXamarin.Mac Fullvs. the default ofXamarin.Mac ModernOnce you do that, you can retarget the packages to that framework:
Now the
Microsoft.Azure.NotifactionHubreference will show up under the package references:Add a
usingclause of:Now you can access the
NotificationHubClientclass: