Cross Origin Resource Sharing (CORS) support to enable your Mobile Service to accept cross-domain Ajax requests. You can now configure a whitelist of allowed domains for your Mobile Service using the Windows Azure management portal.
With this update Windows Azure Mobile Services now provides a scalable turnkey backend solution for your Windows Store, Windows Phone, iOS, Android and HTML5/JS applications.
To learn more about the new HTML client library for Windows Azure Mobile Services please see checkout the new HTML tutorials on WindowsAzure.com and the following short 4 minute video where Yavor Georgiev demonstrates how to quickly create a new mobile service, download the HTML client quick start app, run the app and store data within the Mobile Service then configure a custom domain with Cross-origin Resource Sharing (CORS) support
In this post I will demonstrate how you can poll twitter on a scheduled basis for tweets directed at an alias and then use this information to send a Push Notification in the form of a Tile update. But first lets talk about What’s new for Windows Azure Mobile Services
What was Announced Today!
Today, Scott Guthrie announced updates to Windows Azure Mobile Services which allows developers to take advantage of the cloud to build and deploy modern apps for Windows 8 and iOS. Whether you are a developer building for the Windows Store, Windows Phone 8, iPhone, or iPad, Mobile Services provides an easy, streamlined process for backend elements like storing structured data, configuring user authentication via Windows Live, Facebook, Twitter, and Google, and incorporating push notifications.
If you are building a mobile application Windows Azure Mobile Services can help in the following ways:
Rapid Development: configure a straightforward and secure backend for Windows 8 and mobile applications in less than five minutes.
Create modern mobile app with built in support and new added capabilities:
(NEW)Scheduled Scripts: run a server script on a pre-set schedule or on-demand which enables several key scenarios including:
aggregating data from Twitter, RSS feeds, or any external web services
executing background code efficiently, such as process/resize images, performing complex calculations, or sending emails
schedule sending push notifications to customers to ensure they arrive at the right time of day
(NEW) Command-line support: use the Windows Azure cross platform command line tools to easily create and manage mobile services
(NEW) Availability in Europe: create Mobile Services in the North Europe region in addition to the US East and US West regions
Getting Started with Scheduled Scripts with the Windows Azure Mobile Services Scheduler
In this section I will demonstrate how you can poll twitter on a scheduled basis for tweets directed at an alias and then use this information to send a Push Notification in the form of a Tile update. This is a simplified version of Yavor’s post here - if you want to see how you can filter tweets and take this a bit further jump over to Yavor’s blog and check it out.
Create the scheduler job that will send push notifications to registered clients every 15 minutes with the latest Twitter updates for a particular twitter handle.
Specify a name for the job and make sure the schedule frequency is set to every 15 minutes. Click the check mark to create the job.
Select the created job from the job list.
Select the Script tab and paste the code snippet below that both polls Twitter and then composes a push notification to update your start screens tile using push.wns.*
Once you paste the script into the editor, click the Save button to store the changes to the script.
In Visual Studio, press F5 to build and run the application. This will ensure your channel URI is up to date and will ensure the Default Wide tile is now on your Start screen
Go back to the Windows Azure Management Portal, select the Scheduler tab of your mobile service, and then click Enable in the command bar to allow the job to run
To test your script immediately rather than wait 15 minutes for it to be scheduled, click Run Once in the command bar.
Return to the start screen and see the latest update on your application tile
In this post you learnt how you can use the Windows Azure Mobile Services Scheduler to execute scripts on a scheduled basis. We used scheduled scripts to poll twitter every 15 minutes and send a push notification in the form of a Live Tile to our windows store apps with the latest tweets at an alias.
Here are some related resources you should checkout:
This is a simplified version of Yavor’s post check out his more detailed scenario here
You can get started today with 10 Mobile Services for FREE
Nick Harris is a Senior Technical Evangelist at Microsoft specializing in Windows Azure. Before Microsoft, he founded his own startup AdGAC a mobile advertising company developed utilizing Windows Azure, WP7 and ASP.NET MVC. In the 9 years prior, Nick worked as both a consultant and Senior Software Engineer delivering smart client applications, distributed enterprise applications and airborne software systems. While not working you can find him blogging or on Twitter about Windows Azure along with a diverse range of related technical content.