TechEd NA 2014 – What’s New in Mobile Services and Notification Hubs

TechEd North America 2014, Houston
What’s New in Mobile Services and Notification Hubs – Elio Damaggio, Miranda Luna

Day 2, 13 May 2014, 3:15PM-4:30PM (DEV-B330)

Disclaimer: This post contains my own thoughts and notes based on attending TechEd North America 2014 presentations. Some content maps directly to what was originally presented. Other content is paraphrased or represents my own thoughts and opinions and should not be construed as reflecting the opinion of either Microsoft, the presenters or the speakers.

Executive Summary—Sean’s takeaways

  • Mobile Services is turnkey back-end service for mobile apps
    • Adds features that you don’t need to write yourself
    • Microsoft manages/runs/monitors back-end service
  • Lots of new stuff in Mobile Services
    • Offline sync, push with Notification Hubs, etc.
  • Offline sync – for apps that are sometimes connected
    • Easily sync with Push/Pull paradigm
  • Hybrid Connections allow mobile app to connect to on-premise resource that has static IP
  • Push notifications in Mobile Services now use Notification Hubs
    • High volume, low latency
  • Use Push to silently sync app

Full video

Miranda Luna, Product Manager, Azure Mobile Team, Microsoft – @Mlunes90


  • Mobile Services Updates
  • Notification Hubs Updates
  • Questions & Resources

Mobile Services Investment Areas

  • What’s New
    • .NET backend – Web API on server
    • Heterogeneous data
    • Hybrid connections – between on-prem and Azure
    • Offline sync – occasionally-connected scenarios
    • Xamarin
    • AAD Authentication – Azure Active Directory
    • Visual Studio – tighter integration
    • API Management – publishing/managing access to API
    • Notification Hubs – easier now to achieve high volume, low latency
    • Sencha

Azure Active Directory

  • Extend line-of-business to mobile
  • Adds notion of AD user in Mobile Services
  • Enable applications built around organizational structures

Active Directory Authentication Library (ADAL)

  • Enables single sign-on

Basic ADAL + Mobile Services Flow

  • Access Token / Refresh Token

Access resources on behalf of the user

  • Mobile Service passes Access Token to AAD along with requested resource URI

Mobile Services .NET

  • Easy backend
  • Logic via .NET Web API
  • Turn-key Mobile Backend Capabilities
  • Local debugging
  • Flexible data model
  • Client SDKs for major platforms
    • iOS, Android, Windows, WinPhone, Xamarin, PhoneGap, Sencha
  • Integration with on-premise systems
  • We Manage/Run/Monitor your backend for you

Diagram showing data flow for Mobile Services – Value Add

  • Service the runtime without restarting your app
  • Can inject strings into app.config

New data model – Green field

  • DataManager – DTO – Entity for SQL

Existing data model – Brown field

  • DataManager – DTO / AutoMapper / Model
  • Maps to existing database

Offline support

  • Applications that are occasionally connected
  • Conflict resolution – users
  • Explicit Push/Pull to/from Mobile Service
  • TableController – with optimistic concurrency

Offline support

  • Store table operations in local data store
  • SQL-lite out of the box
  • Can use what’s out of the box or roll your own

Offline Methods

  • PushAsync – on entire context
  • PullAsync – pull all or a subset of items from remote
    • Pull triggers a push, for data inconsistency
  • PurgeAsync
    • Clear local cache to update data which app no longer needs
    • Purge triggers a push

Handling Offline Conflicts – code snippet

Hybrid Connections

  • Fastest way to consume on-premises resources in Mobile Services app
  • Connect to any on-premises resource that uses static TCP port
  • BizTalk Services hybrid connections

API Management

  • Mobile Services, Web Sites – Build & Host
  • API Management – Publish & Manage
    • Acquisition – “Epiphany”

API Management diagram

  • Admin portal – where you set policies, etc.
  • Developer portal

API Management Features

  • EXPOSE – discovery
  • PROTECT – authorization, quotas, rate limits
  • UNDERSTAND – usage, health, latency, activity, trends
  • MANAGE – lifecycle, versioning, monitoring

Elio Damaggio, Product Manager, Azure Mobile, Microsoft

Push Notifications

Notification Hubs – Azure hub that deals specifically with Push Notification

What’s New

  • Kindle support
  • Tag expressions
  • Visual Studio integration – send debug notifications
  • Mobile Services integration
  • New push-based pricing – based on # pushes
  • Build registration management APIs
  • Xamarin

Push Notifications

  • Push 101
  • Use Notification Hubs ..

Push 101

Mobile push is everywhere

  • Toasts, etc. in notification center
  • E.g. breaking news, SMS replacement
  • Healthcare LOB, e.g. prescription reminders
  • Travel, etc.

Push notification lifecycle

  • Registration at app launch
    • Retrieve current channel
    • App updates handled in back-end
  • Sending Notification
    • App back-end send notification to PNS (Platform Notification Service)
    • PNS pushes notification to the app on the device
  • Maintenance
    • Delete expired handles when PNS rejects them (tokens expire)

Challenges of push notifications

  • Platform dependency
    • Different communication protocols
    • Different presentation formats and caps
  • Routing
    • PNS provides way to send message to device/channel
    • Notifications targeted at users or interest groups
    • App back-end has to maintain registry associating device handle to interest groups/users
  • Scale
    • App back-end has to store handles for each device – high storage and VM costs
    • Broadcast to millions of devices with low latency requires parallelization

Advantages of using Notification Hubs

  • Cross-platform
    • REST-based
    • Support many client platforms
  • No need to store device information in the app back-end
    • Notification Hub does this
  • Routing and interest groups
    • Target individual users and large interest groups using tags
    • Free form, can use them for user IDs or for interest groups
    • From single user/device to big groups
  • Personalization and localization
    • Keep back-end free of presentation concerns like localization and user prefs using templates
  • Broadcast at scale, multicast, unicast
    • Push notifications to multiple devices with single call
  • Telemetry
    • Through portal or APIs

Using Notification Hubs

  • One-time setup
    • Create Notification Hub
  • Register
    • Client app gets handle from PNS
    • App updates registration

Some snippets

  • Register and Send


  • Tags as interest groups
    • When device registers, it specifies a set of tags
  • You can use tags for
    • Interest groups
    • Tag devices with user id
    • No need to pre-create

Tag expressions

  • E.g. “all my group except me”
  • OR, AND, NOT, etc.
  • Send notifications at specific times, or to time zones
  • Versions and platforms

Case Studies

  • Bing apps
    • All use Notification Hubs to power their notifications
    • 10s of millions of devices
    • 3 million notifications/day
    • <2 minutes to deliver
  • Sochi 2014
    • 100s of interest groups (countries, disciplines, athletes)
    • Localized notifications
    • 3+ million devices
    • 150+ million notifications, over 2 weeks

Notification Hubs & Mobile Services

New push engine for Mobile Services

  • Based on Notification Hubs (powered by)
  • No more Channels table
    • Simple two steps process to push notifications, no data handling
  • 1 Unit of Notification Hubs included for free
  • Node.js and .NET (back-ends)

From Mobile Services

  • Register and Push

Secure tags for push to users

  • Cases when Push used to enhance responsiveness of app

Register from your back-end

  • When tags have to be secured
    • E.g. userId for tag
    • App back-end can authenticate user before registering the device
    • Mobile app can’t connect notification hub directly
  • When back-end has to modify tags
    • Tags might depend not on user prefs, but on other global things
    • Back-end has access to add/remove tags from what device sends

Registering from the back-end

  • Identify your device
    • Keep long-living NH registration ids in device storage
  • Register
    • First time only, on app start – get registration id from hub, store in local storage
    • CreateOrUpdate device registration (every app start)
    • Back-end can verify and/or add tags (e.g. performing authentication)
  • Notes
    • Nothing stored in app back-end, not doing device management
    • Don’t use device SDK – will create multiple things

Back-end driven tag updates

  • Use tag to identify user
    • Back-end refers to users and not devices
    • Register devices with tag like userid
  • Back-end updates tags
    • Retrieve device registration by userid
  • Note
    • No device information in back-end
    • Back-end only refers to users

Very easy with Mobile Services (.NET)

  • Registrations already through through back-end
  • Just login the user in the device
  • Register from device (RegisterNativeAsync)
  • Implement registration callback to inject user tag
    • InotificationHandler.Register
  • Push to user
    • SendAsync to user ID

Secure Push & Rich Push

  • Deliver content directly from back-end
    • Rich media
    • Retrieve content securely from BE
  • Will look the same to user, but data won’t go through cloud service
  • Notes
    • Platform dependent
    • Secure push has to use long-lived auth token on app
    • App pulls data directly from back-end, but not yet showing anything to user

Push to Sync

  • Updates app state
    • Does not show message to the user
  • Example: music app
    • User changes playlist on desktop
    • Back-end send push-to-sync notifications to user’s devices
    • Even w/o opening app
    • User finds the new song already on their phone
  • User this feature with Offline feature of Mobile Services – local store
    • So everything just already right there
  • “This is what people expect from mobile apps” – no waiting
  • Platform-dependent
    • Windows, et al


  • Portal dashboard, programmatic access for all PNS outcomes
  • Security
    • Role-based security available to restrict access to hub for various rights
  • Scale
    • Guidance for high scale depends on specific scenarios
    • <5 million devices and <5 million pushes per day can just use single hub – no problem


  • $20/unit/mo (“unit” is NH)
  • 500,000 pushes per unit per month

Miranda again

Azure Mobile

Microsoft is making a massive investment to provide an end-to-end story for cross-platform mobile app development and management

TechEd NA 2014 – Create Applications that Span Devices and Services

TechEd North America 2014, Houston
The Microsoft Development Platform: Create Applications that Span Devices and Services – Scott Hanselman 

Day 1, 12 May 2014, 11:00AM-12:00PM (FDN05)

Disclaimer: This post contains my own thoughts and notes based on attending TechEd North America 2014 presentations. Some content maps directly to what was originally presented. Other content is paraphrased or represents my own thoughts and opinions and should not be construed as reflecting the opinion of either Microsoft, the presenters or the speakers.

Executive Summary—Sean’s takeaways

  • For developers, we need to focus on Cloud + Mobile
  • Very easy to debug/test using Azure
    • Attach Visual Studio debugger to web app running in Azure
  • Microsoft Azure Mobile Services – turnkey back-end solution for mobile apps
  • Modular focus – ability to pick the stuff you want, leave the stuff behind that you don’t
    • Choice
    • “Bring your own” – platform, tools, framework
  • Cross-platform – use Xamarin to get breadth
    • Lots of code reuse across platforms
    • Tools help you with this
  • Native vs. Web app
    • Native is best experience
    • Web app is “shortest path”

Full video

Scott Hanselman – Microsoft


What we are hearing from you

  • Devs more important than ever
  • Cross-platform required


Developer needs

  • Optimize for cloud / devices
  • Hybrid

Today’s Cloud/Mobile

Cloud scenarios

Dev & Test in the cloud

  • Old world—process took couple week
  • Plug stuff into Azure

Demo – VMs


VM demo

  • Private network
  • Can quickly fire up VM in virtual network
  • Fire up Win 7 VMs in Azure for dev/test
  • Can VPN into VM in cloud
  • Remote into the machine
  • E.g. testing WPF app on Win 7 VM

Back in Visual Studio – Rt-click, Enable Debugging

  • Attach, set breakpoint
  • Back in VM, exercise app
  • Complete remote debugging session in Visual Studio
  • You only pay for VM while it’s provisioned


Web Apps in the cloud

  • Standards based
  • Highly interactive apps
  • Enterprise complexity

Browse With – various browsers

  • Can push Refresh out to multiple browsers
  • Ctrl-Design, hover around browser
  • Modify in Design mode in browser, updated in real-time in code
  • Browser Link

File New project, host in web

Hybrid Apps

  • Maybe want parts of an app on the public internet, part in private network
  • BizTalk Hybrid Connections (preview)
  • Also
    • Virtual network et al

BizTalk Hybrid Connections

  • Tunnel to corp network to get resources

Demo – Hybrid Connections

  • Web site is connection to a specific host (HP laptop)
  • E.g. connection string is hooked to the local machine
  • Service on local machine – Hybrid Connection Manager

Mobile Apps in the cloud

  • Microsoft Azure Mobile Services
  • Back-end API running in cloud
  • Turnkey backend for Mobile Services
  • Extend internal web apps to mobile devices
  • Powerful client-side library for multiple devices
  • Offline sync support
  • Available on any platform

Demo – Managing web API on Azure

  • Supports JSON and .NET APIs
  • Postman, Chrome extension – RESTful client

Web API in Azure:

Using Postman to test Mobile Service Web API:

Future of .NET

  • .NET vNext
  • Multi-purpose
    • Client –
  • Specialized
    • Device optimized – for client
    • Web and service – Cloud optimized
  • Side by side compatibility, each app has its own version of the CLR
    • Break apart Framework, just use the parts that you need
    • Small footprint
  • Common stuff
    • “Entity Framework” everywhere
    • All open source and all in .NET Foundation

ASP.NET vNext and the Modern Web

  • Modular – swap out stuff you don’t like
  • Seamless transition from on-premises to cloud
  • Open Source with Contributions
  • Faster development cycle
  • Choose Editors and Tools
  • Cross-platform

New project, ASP.NET vNext application

  • Nested references, can pull stuff out
  • Project system changing
    • Unified Nugets and References
    • Bring in packages by just typing
  • Run the app
  • Go into controller – C# code
    • Just type in code, don’t do build step, then refresh browser and stuff changes
  • No DLLs in \bin folder
  • With Roslyn, just do everything in memory, doesn’t store bits to DLL
    • Code/refresh/repeat
  • Pick specific packages in NuGet that you want
    • As opposed to installing .NET on local machine
    • Makes it easier to try new stuff without breaking old apps
  • Looking at various .nupkg builds, each of which is some subset of .NET Framework

Demo – Visitors App –

  • Self-hosted, no IIS, run hosting environment in command line
  • Do same app on OS X, ASP.NET running in command line on Mac, web site hits local service

ASP.NET vNext Summary

  • Choice
  • MVC, Web API, Web Pages 6, SignalR 3, EF 7
  • SPS: Entity Framework still a first-class citizen

Cross-platform mobile development – Client

Multi-device approaches

  • .NET – rich experiences
    • Use Xamarin to get breadth
  • Coming from HTML side
    • Hybrid apps to get better richer experience

Windows Store Apps

  • Universal Windows apps
  • .NET Native

Demo – Universal App demo

  • Shared module in universal app – ViewModels, resources, etc.
  • Some Views shared, some views custom

Run Universal App

  • Win Phone emulator, Win 8 tablet
  • Debug Windows Store apps on your machine, RDPs into simulator
  • Win Phone – app running on phone

.NET in Android, iOS devices

  • Native mobile apps
    • Full access to device features
    • High flexibility and customization per device
    • Best US and performance in devices
  • Xamarin
    • Microsoft/Xamarin technical and
      business partnership
    • Visual Studio and C# capabilities fully available
    • Share app logic code across device platforms

Xamarin demo

  • Same app on Android and iOS
  • Android app can use shared component from universal project
  • Run app on Android tablet (Samsung Galaxy Fab?)
  • Remote debugging on physical tablet
  • “Android app that looks like an Android app” – on tablet, native
  • Then run the app on an Android phone and on iPad

“Native cross-platform mobile development”

Cordova tooling in Visual Studio

  • Hybrid-HTML apps
    • Natural path for web devs targeting devices
    • Shortest path for cross-platform mobile
  • New Cordova tooling in Visual Studio
    • Multi-device Hybrid Apps for Visual Studio
    • Hybrid apps
    • Flexibility to use any JavaScript framework
    • Scale to complex Enterprise apps through optional TypeScript support
    • End-to-end dev workflow included

Visual Studio benefits

  • File New Project – now have Android, iOS, F#, Python, Node,
  • Can start VMs from Visual Studio, attach to debuggers
  • Fire up VMs, make web sites, deploy
  • Bottom line – amazing power to developer

Demo – Hybrid App, Cordova tooling

  • Devices listed in Device dropdown in Visual Studio
  • “Ripple” support
  • Debug Cordova from Visual Studio


  • Providing the best end-to-end development experience
    • Platform
    • Framework
    • Tools
  • On our terms
    • Bring your own in each area