Push Notifications for Xamarin.iOS

Configuring Notification Hubs for Xamarin.iOS apps

Some user devices are iOS-based, some Android, some Windows Phone, and the list goes on. Each of the native platforms has its own push notification framework and backend service. Azure Mobile Services allows the developer to configure a single Notification Hub (based on Microsoft Azure Service Bus Notification Hubs) through which notifications may be sent. The notification goes to each user via the correct push service according to her device’s requirements. Broadcast to millions in consumer scenarios, to tagged groups, to individuals with the same ease.

To use notifications hub from Azure Mobile Services with your iOS apps, you need to generate a certificate, register your iOS app for push notifications, save your certificate to a file and upload to Azure Mobile Services Management Portal, into your Notifications Hub. The whole process of generating a certificate, and configuring Azure Notification Hubs for use with iOS apps here, which is fairly extensive and has some screenshots.

Code snippet: Xamarin.iOS app using Push Notification Hubs

We use Xamarin Forms for best cross-platform portability: we can re-use the same UI and most of the middle tier in our Android project as well.

1. In Xamarin Studio on your Mac, or Visual Studio on your PC, create a new Xamarin Forms project. We will need to use WindowsAzure.Messaging from GitHub. Compile WindowsAzure.Messaging.dll and reference it in your project. This assembly provides iOS bindings for Notification Hub:


2. For Xamarin.iOS project, we need to make some changes in the AppDelegate.cs file. First, start by adding:
SBNotificationHub _hub;

public const string _azureConnection = “<Azure connection string>”;

public const string _notificationHubPath = “<Azure hub path>”;

3. Next in FinishedLaunching method add this to register for remote notifications in your app (providing several types of notifications):


UIRemoteNotificationType.Alert |


4. Add the following methods to handle registration and notification processing.

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)


_hub = new SBNotificationHub(_azureConnection, _notificationHubPath);

_hub.UnregisterAllAsync (deviceToken, (error) => {

if (error == null)


NSSet tags = null; // create tags if you want

_hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) =>


// handle errors here





// handle errors here




public override void ReceivedRemoteNotification(UIApplication application, NSDictionary options)


if (null != options && options.ContainsKey(new NSString(“aps”)))


NSDictionary aps = options.ObjectForKey(new NSString(“aps”)) as NSDictionary;

string alert = string.Empty;

if (aps.ContainsKey(new NSString(“alert”)))

alert = (aps[new NSString("alert")] as NSString).ToString();

if (!string.IsNullOrEmpty(alert))


UIAlertView avAlert = new UIAlertView(“Notification”, alert, null, “OK”, null);





We can now register for hub notifications and receive notifications, displaying alerts in our Xamarin.iOS apps.


Get started with Notification Hubs with Xamarin.iOS
Xamarin.iOS: Push Notifications in iOS

Native Cross Platform UI Ideas for iOS, Android, Windows Phone with Xamarin

For many developers using C# and coming from the modern UI apps on Windows, developing cross-platform UI design with the best usability for Windows, iOS and Android presents an interesting challenge. First, they feel like they are coming to a more ‘traditional’ UI: let’s face it Microsoft team has created some very advanced and neat design concepts with the modern apps: with Modern design language, minimalism, panorama, motion animations and pivot. How do you translate that into iOS and Android?

Luckily, Xamarin team has done a lot of research porting and thinking through many of these ideas. Xamarin Forms are based on XAML and work on iOS, Android and Windows Phone natively. Here’s some interesting ideas to keep in mind building a cross platform app with Xamarin Forms:

Is cross-platform UI achievable and does it work fast and look native? Thanks to Xamarin team’s efforts the answer to this is yes! You can write UI code that will look and feel native with native speeds on iOS, Android and Windows Phone.

Things to remember: Forms markup uses XAML, but Xamarin team chose to use objects from iOS and Android stack. So instead of StackPanel you get StackLayout, TextBlock is Label. Attributes also resemble those of Android AXML: Visibility becomes IsVisible (we actually like that, it eliminates a converter which otherwise needs to be used on each boolean property). Background color property becomes BackgroundColor, Foreground property becomes TextColor, ForegroundColor etc depending on the context. In other words: instead of cut and paste from Windows Phone you need to really update your XAML. Which makes a lot of sense, Xamarin team chose to use Android/iOS UI elements in XAML.

Xamarin also figured out a very smart strategy wrapping native controls, while maximizing code re-use. On the screenshot below, Xamarin Forms maps control renders as a native Android, iOS and Windows Phone map on each platform.


Source: Xamarin: Controls Gallery

Active Fitness with SensorCore – Pedometer + GPS + Social + Action Photo + Music all in one free app

DOWNLOAD new version

Do you need to spend extra bucks on pedometer when you already have a phone? Now with SensorCore technology in latest Windows Phone 630 and other models, your phone can work as a pedometer and count your steps, whether walking or running 24×7. With apps like Active Fitness which already has millions of active users, adding step counter in addition to GPS Tracking adds a battery efficient way and yet another dimension to measuring your sport performance.



Active Fitness unites millions of active users in a fun friendly social sports app and network. Now with new Lumia 630 devices and SensorCore technology, Active Fitness adds battery friendly Pedometer function. Simply take your phone with you and it’ll automatically count steps whole day long! Very little battery consumed. Active Fitness has also been redesigned to benefit from new features of Windows Phone 8.1, you’ll immediately notice many friendly improvements for an already beautiful app. Other features include: multiple activities from a comprehensive library, music, action photos, GPS tracking, goals, training module powered by professional instructors and more!



Detailed charts of your activity

Active Fitness allows you to drill from monthly to weekly to daily view and then more into every split of your run! Windows Phone brings a clean fresh consistent design and everything about this fitness app looks great.




Microsoft and Nokia at National Academy 2014

Microsoft and Nokia Lounge at PSIA-AASI National Academy 2014

PHOTOS, even more photos…


For the second consecutive year, it is becoming a tradition that Microsoft and Nokia participate in the outdoor educational events. One of these events is National Academy, a week-long event in Snowbird, Utah, at an altitude of 10,000ft gathering top ski and snowboard instructors from North America. PSIA-AASI is the nation’s oldest snow-sports educational organization, uniting more than 32 thousand professional ski and snowboard instructors. In 2013 Microsoft and Nokia teams for the first time participated in this event with a launch of Winter Sports, a ski and snowboard sports tracking app for Windows Phone and Windows.

This year highlights:

· Microsoft/Nokia Lounge

· Direct Verizon Sales: sold many high-end Windows Phones on-site

· XBOX ONE + fitness and games

· Nokia Lumia Icon, 1520, 1020, 520

· Nokia Accessories (Wireless Speakers, gadgets, wireless chargers, batteries)

· 3,000,000+ vertical ft tracked by the  app

· 50+ Windows Phones used on the mountain every day


Outdoors Industry and Windows Devices

This year, we expanded our collaboration with the organization, by creating an on-site Microsoft/Nokia Lounge, equipped with Xbox One, fitness apps and games, and bringing 50+ Windows Phone devices: from smallest Nokia Lumia 520, to top of the line Nokia Lumia 1020 phone with 41 megapixel camera, Nokia Lumia Icon and large 6″ screen Nokia Lumia 1520 phablet, as well as Microsoft and Nokia tablets, such as Microsoft Surface. Each instructor could use Winter Sports app, tracking activity on the mountain, the app uses Microsoft Azure cloud to store tracking information securely and reliably (also see Microsoft case study).


Windows Phone apps

This event helps Microsoft and Nokia to collaborate with top sports and outdoor organizations, having devices used in real-life mountain high-altitude conditions, taking professional grade pictures and sports activity tracking and gathering feedback from top North American ski and snowboard instructors, including National Team champions. Also check out these apps for Windows Phone and Windows:

Winter Sports

Active Fitness


Rollerblade® Inline Skates

Microsoft/Nokia Lounge at 10,000ft


Microsoft/Nokia Lounge at 10,000ft in Cliff Lodge was set up for the whole week to present latest gadgets from Microsoft and Nokia, and became an Xbox One playground. For one week we entertained instructors with latest fitness and sports apps and Xbox games, demoed latest Windows Phones and Windows tablets, as well as Nokia accessories, such as wireless speakers, wireless chargers, headphones, phone batteries and more.

During the trade show we also had Verizon on site, selling Windows Phone devices. After ski and snowboard instructors were introduced to Winter Sports app, some were interested in purchasing top of the line Lumia Icon devices with unbeaten screen resolution and 20 megapixel camera. We certainly recommend these devices for ski instructors, because of their quality, reliability, great camera resolution, built-in action shot features and great outdoors apps.

Educational On-Snow Events

Some of Microsoft’s own team are certified ski instructors and participated in the on-snow educational groups. We skied Snowbird and Alta, tracking skiing with Winter Sports app: in one week the app tracked 3,000,000+ vertical feet, tracking supported by Microsoft Azure cloud technology. Anyone had an opportunity to try one of several Windows Phone models. Great thing about Windows Phones is that they support a variety of form factors and features: from best camera phone in the world: 41 megapixel Lumia 1020, to a small footprint very inexpensive Lumia 520, to 20 megapixel Lumia Icon device.

In-class events and trade shows

During the National Academy we had a number of in-class training events and a trade show. During the trade show we had a joint Microsoft/Nokia/Verizon booth set up, with devices available for sale from Verizon. A number of high end Windows Phones were sold and activated at Verizon booth.

Next Year

We are planning to continue working with National Academy and bring the excitement of technology and new devices to the world of outdoors.


On the photo above: a special WINTER ski named after the app is signed by National Team coaches at National Academy. The right ski was signed at 2013 National Academy. The left ski was signed this year. I guess next year we need to make new skis J


even more photos…


Rollerblade® Inline Skates app launched at BUILD

As the summer and spring season starts, I’m happy to announce that we just launched Rollerblade® Inline Skates app at Microsoft BUILD conference in San Francisco!


The awesome sports app is immediately available from Nokia Collection on all Nokia Windows Phone 8.0 devices. More to come… SmileSmileSmileSmileSmile

From our partner:

West Lebanon, NH –Rollerblade®, the international leader in the inline skating industry, recently announced the launch of the Rollerblade® Inline Skating App, a brand new application that’s taking the sport to a whole new level. Through a partnership with Nokia, Microsoft, and the Active Network, the Rollerblade® Inline Skating App is the official application for the sport and will enhance the skating experience for users worldwide. The new Windows 8 Phone app allows users to enjoy features such as tracking workouts and fitness goals, sharing progress and photos with friends and family via social media, finding the newest gear, and photographing their skating experience.



Active Fitness for PC, tablets and Surface

Download Active Fitness for PC, tablets and Surface: http://apps.microsoft.com/windows/app/active-fitness/5a64d9f1-aea7-493c-a353-da41c08c0e77

Active Fitness for PCs and Tablets

Active Fitness is a personal trainer and fitness organizer for your Surface tablets or any Windows PC, with a companion Windows Phone app and a social network of quarter of a million users. Active Fitness is great for running, cycling, walking and hundreds of other activities, the app that earned raving reviews by Microsoft Phone blog and WPCentral for its companion Windows Phone app. Now with a Windows version of the app, you can enjoy your free sports analytics from the comfort of your tablet or PC and import data from other apps or devices.


Take your active lifestyle with you

With Active Fitness you can use the same account you used for companion Windows Phone app, or your Winter Sports app account from another popular app for tracking activities. You are presented with a simple and rich interface that allows you to check your stats, add your activity from Windows Phone or any other app or device, check your training schedule, find your friends and see where they run or exercise and more!


Hub for all your sports activities

Active Fitness automatically synchronizes your data with Windows Phone Ski & Ride app, and easily imports your data from other apps, Web sites and devices. Essentially, Active Fitness is a personal trainer, organizer and a fitness hub for all your sports activities on any Windows devices.


Personal Training

Active Fitness provides dozens of training plans: both videos and automatically tracked with Active Fitness app for Windows Phone. Training plans keep you organized and motivated, and you can see your progress real-time as you run or cycle with Windows Phone.


Companion app for Windows Phone

Active Fitness app comes with a free companion app for Windows Phone: the app that earned raving reviews from Microsoft Phone blog, WPCentral and is included in Nokia Collection.


Feels like Olympics

Active Fitness has a rich global leaderboard that immediately makes you feel like you are in the middle of Olympic Games. Compete with thousands other users of Active Fitness social network and Active Fitness will track your position on the leaderboard.


Where’s your friend?

Active Fitness has 200,000+ active users, the number that grows by thousands every day. To see where your friends are, use Active Fitness Friend Finder feature to find your friends.


For Windows PC, tablets and Surface


For Windows Phone