BT

Windows Azure Mobile Services with Push Notifications Support

by Anand Narayanaswamy on Dec 28, 2012 |

The Windows Azure Mobile Services team recently announced support for push notifications via Apple Push Notification Services (APNS) which enables users to fire push notifications from mobile service scripts including significant feature improvements to iOS Objective C SDK.

In order to enable your Windows Azure Mobile Service application with APNS you need to follow the steps mentioned below

  • Configure application in the Apple iOS provisioning portal
  • Upload the APNS push certificate to the Apple provisioning portal
  • Upload your APNS push certificate to Mobile Services using the Windows Azure admin portal
  • Click Upload button from within the Push tab of your mobile service
  • Browse your local file system from the Upload Certificate dialog and upload your exported certificate
  • Select the mode - Dev (Sandbox) or Prod (Production)

The code to send a push notification to your clients from within a Windows Azure Mobile Service will look like as given below

push.apns.send(deviceToken, {
     alert: 'Toast: A new Mobile Services task.',
     sound: 'default'
     });

The above code enables Windows Azure Mobile Services to connect to APNS and send a notification to the relevant iOS device via the deviceToken. Microsoft also provides an ability to incorporate a script to process your APNS feedback which will be executed by mobile services on a regular basis as long as the azure service is active.

You can simply call the apns object's getFeedback() method from within the feedback script which returns a list of invalid tokens that can be removed from your database as shown below.

push.apns.getFeedback({  
  success: function(results) {
  }
});

Microsoft has also announced improvements to the iOS client API with the addition of an login method - loginWithProvider, which automatically dismiss login view controller as a modal dialog on the specified controller thus enabling you to easily implement authentication via Twitter, Google, Facebook and Microsoft Account with a single line of Objective-C code:

[client loginWithProvider:@"twitter" 

    onController:self
    animated:YES
    completion:^(MSUser *user, NSError *error) {
    // if no error, you are now logged in via twitter

}];


Josh Twist, Program Manager, Windows Azure Mobile Services, Microsoft demonstrates the above features in a short video presentation

After watching the demo, Adam Cooper posted the following question:

Is JavaScript the only supported language for this? For those of us who are C# developers

Paul Batum, Program Manager, Windows Azure Mobile Services, Microsoft replied to Adam's question:

JavaScript is the only supported server side language for Mobile Services right now, but that may change in the future. We have heard from a number of developers that they would like to be able to use C# instead as you suggested. I would encourage you to go to our user voice and vote for this if its important to you!.

Pranav commented:

Why would I use Azure to develop iOS apps?

Duncan Mackenzie answered:

If you need a server component to your iOS app, this gives you that option

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT