Chris Risner . Com
Posted on: 1/5/2013 6:50:00 AM by Chris
Windows Azure Mobile Services has been available for over four months now and it’s been getting more awesome every day. If you aren’t already aware, Mobile Services is a turnkey backend solution for making mobile apps. In other words, if you’re building a mobile app but don’t want to worry about coding, testing, deploying, and supporting a backend, you can spin up a Mobile Service and use that as your backend. This gives you access to tons of features including structured storage, authentication, push notifications, and scheduled backend jobs. If you compare the time it would take you to build all of those features on your own, the time savings is crazy! Today I’m going to collect and present a number of links to solutions for common scenarios and questions that come up when using Mobile Services. As you’ll see, even in this short period of time, lots of people have started to use and enhance Mobile Services.
Mobile Services Dev Center – This is the root of all official Mobile Services reference.
Tutorials on the Dev Center – These links will direct you to different tutorials for specific platforms:
Starting with data
Validate data with scripts
Paging in queries
Starting with auth
Single sign-on with Live Connect
Authenticating users in scripts
Starting with push notifications
Push notifications to users
*there aren’t any links for Android right now because we don’t have an official SDK. Those will come soon.
Additionally, there are a few tutorials in the Dev Center that aren’t tied to a specific platform:
Using SendGrid – SendGrid is a module you can use to send emails from your Mobile Service scripts
Scheduling backend jobs – One of the capabilities of Mobile Services is to write scripts that can either run on a schedule or on demand in the backend.
Mobile Services Stuff
Windows Azure Mobile Services forum – If you have problems or questions, this is a great place to check and ask. It’s monitored by the product team on a daily basis.
Mobile Services SDK Source Code – Shortly after launching Mobile Services, the SDK was released to GitHub. As changes are made to the SDK the version in GitHub will be updated to match.
Mobile Services Reference – This documentation details many of the different concepts and capabilities of Mobile Services.
Service Side Script Reference – While a part of the reference docs above, this is a really handy section so I’m listing it separate.
REST API Reference - This is another part of the reference material above. This goes over the actual REST API created for your Mobile Service. You can use this to figure out how to access your Mobile Service from any other technology that doesn't have a supported SDK.
What is Mobile Services and Why was it made – Josh, one of the creators of Mobile Services, has a nice write up on the motivation for making Mobile Services here.
Using Filters on the Client side – Josh delivers again by explaining how to use Filters to indicate a busy or active status to the client. Code included covers C# and Objective-C.
Unofficial Android SDK – Prior to the release of the official Android SDK for Mobile Services in March of 2013, Microsoft MVP, and my friend, Sasha Goldshtein, worked very hard on an Android SDK for Mobile Services. This thing gives you all of the capabilities of each other platform (data, auth, and push) with easy integration.
Unofficial WP7 C# SDK - There isn't any official support for Windows Phone 7 at this time either. Another community member stepped up and created an unofficial one for Windows Phone 7 in C#
The Mobile Services Pipeline – Here, Josh explains the pipeline for handling data from scripts to storage. Code samples included are in C# and js.
Inserting Multiple Items with One Call – This tutorial will walk you through how to send an array of items over to handle inserting multiple items with one call to Mobile Services (as opposed to one call per item). As a bonus, you’ll see how to handle datetime conversion issues for embedded arrays. Code shown is C#, JS, and Objective-C.
Seeding Tables with Data – This tutorial will explain how to seed your Mobile Services tables with data. It uses the approach of creating a console app in Visual Studio and using AngelaSmith to intelligently fill data objects. While this approach requires Visual Studio and the use of .NET, there is nothing to stop you from taking the same idea and implementing it using another system.
Storing per user data – This tutorial demonstrates two different ways to save and filter by User ID: on the client and on the server. Yavor also explains which approach is better and why. Note that this entry covers a bit of data and a bit of scripts. The code demonstrated is in JS.
Supporting unsupported data types – Currently the number of data types supported by Mobile Services is somewhat limited. Here, Yavor walks through how to handle unsupported types in a C# client using the IDataMemberJsonConverter interface. The code is specific to .NET but the idea could be adopted to other platforms.
Supporting complex types – This is similar to the previous link as it involves using a special converter to convert complex (i.e. objects containing objects) objects into JSON for Mobile Services to handle. Again, the code is specific to .NET but the idea could be adopted to other platforms.
Implementing 1:n table relationships – By default, Mobile Services doesn’t support foreign keys or relationships between tables. This walkthrough will demonstrate how to serialize data for complex objects with complex relationships and then save and read that data on the server. The client side code is C#, however, the server side scripting would be the same for any client side technology.
Uploading images to Blob Storage – By default, Mobile Services uses SQL Database for all of it’s data storage. However, if you want to store a lot of file data, Windows Azure Blob Storage is a much more cost effective medium. This article by Nick will walk you through how you can accomplish this in a secure manner. The client side source code is C# but on the server side, the scripts will be the same regardless of your client.
Accessing your Mobile Services data from Excel – A tutorial on pulling your data from Mobile Services into Microsoft Excel for manipulation and examination.
Deleting Table data from the Portal – An explanation on how to delete individual rows or truncate whole tables using the Mobile Services portal.
Using an Existing Database with Mobile Services – This walks you through connecting an existing database to Mobile Services by changing the table schema. This approach may also require changing column names and data types.
Using an Existing Database without Changing the Schema – This tutorial walks you through how to connect an existing SQL database to Mobile Services without changing the schema. This is particularly useful if you have an existing codebase already accessing your database and don’t want to change the schema.
Migrating Microsoft Access Apps to Mobile Services - Scott has posted a 3 part series on migrating Access applications into Mobile Services. This includes a lot of data migration to make things work nicely.
Working with Typed and Untyped Data - Yavor talks about how you can use typed or untyped data with Mobile Services and Android. The quick start Todo List demonstrates Typed data (where there is a class that's tied directly to the table in the backend). The real gem of this walkthrough is an understanding of how to handle untyped data on the client side.
Customing Serialization using the gson Library - Yavor walks through how you can alter your data seriailzation from an Android application using the gson library.
Accessing Table and Blob Storage from Mobile Services - Here I walk you through how to connect to Table and Blob Storage from the server side scripts in Mobile Services. This effectively shows you how to save your non-relational data into Table Storage and then read it out as well as how you can generate Shared Access Signatures so you can upload files to Blob Storage. This article just covers the server scripts as the next two walk through calling those methods from an iOS and Android client.
Connection iOS Apps to Table and Blob Storage with Mobile Services - This is the iOS client article which acts as a companion to the article above about connecting apps to Windows Azure Table and Blob Storage by using Mobile Services as a proxy.
Connection Android Apps to Table and Blob Storage with Mobile Services - This is the Android client article which acts as a companion to the article above about connecting apps to Windows Azure Table and Blob Storage by using Mobile Services as a proxy.
Accessing Provider (Facebook, Google, Microsoft Twitter) APIs for more information – This tutorial will walk you through how to make calls to the different auth providers underlying APIs for more information (for example to get their Facebook username). In addition, Carlos explains how to pull the provider token down to the client so you can access those APIs from the device and not from server side scripts. The code demonstrated here is all server side JS.
Explaining Auth – Yavor walks through how authentication works with Mobile Services as well as some potential issues you may run into.
Generating a Mobile Services Auth Token – When a user authenticates with Mobile Services using a provider, an auth token is generated and returned to the client. Here, Josh explains how to generate one of these tokens manually in the server side scripts.
Fetching User Profile information – Josh delivers another example on how to pull more information from a Provider’s API after a user has authenticated.
Caching the User’s Identity and Setting it on the Client – An explanation on how to store the user’s auth token locally on the client and set it on app relaunch so the user doesn’t have to continually log in.
Handling Expired Tokens – Along with the above link, Josh explains how to handle an expired token if you do choose to store the token locally.
Custom Identity in Mobile Services – Josh finishes his 12-part series on Mobile Services by talking about using a custom identity provider in Mobile Services. Using the tips in this article, you should be able to create your own authentication system with Mobile Services.
Fully Logging out of an iOS App with Mobile Services – When you use Mobile Services to authenticate, you can’t just log the client out by calling a method on the Mobile Services client. This tutorial walks you through the steps taken to fully log a user out.
Setting up providers and custom auth with Mobile Services - This post covers how you can get a Mobile Service setup for auth with Facebook, Google, Microsoft, and Twitter as well as how you can enable custom authentication via scripts so that users can register new accounts with a username, email address, and password.
Authentication with iOS and Windows Azure Mobile Services - This post goes over how to connect an iOS app to the above Mobile Service which will handle authentication with all of the built-in auth providers, custom auth, caching user authentication, and handling expired user tokens.
Authentication with Android and Windows Azure Mobile Services - This post goes over how to connect an Android app to the above Mobile Service which will handle authentication with all of the built-in auth providers, custom auth, caching user authentication, and handling expired user tokens.
Using the Facebook SDK for Windows Phone and Mobile Services - This post talks about how you can use the Facebook SDK for Windows Phone to authenticate, as well as do other things with Facebook, in conjunction with using Mobile Services
Script How Tos – This is part of the documentation and reference mentioned above but it’s worth mentioning specifically because it has very simple “How do I do X?” with answers.
Complex query filtering – This tutorial starts with the basic where clause that can be added to filter by UserId and then expands on that to talk about the SQL generated from a filter and how to perform more advanced filtering.
Sending SMS messages from server side scripts – Thanks to integration with Twilio, it is possible to send SMS messages from your server side scripts. You’ll need to look about two-thirds of the way down this entry to see the server side js.
Making HTTP Requests from Scripts – Josh does a nice walkthrough of performing HTTP requests from server side scripts.
Unit Testing your Scripts – An explanation of how to locally unit test your scripts before using them in Mobile Services.
Handling Expired Channels for Push Notifications - This explains how to handle expired or invalid channel URIs when doing push notifications for Windows Store or Windows Phone apps
Scrubbing Data on a Read - This post explains how to scrub sensitive data from a READ operation prior to returning the data to the calling app
Debugging your Mobile Service Scripts - Josh walks through debugging your Mobile Service Scripts using Node, Mocha, and Chrome
Handling Different Operations in the Same Server Side Script - Here, Josh goes over how you can pass an operation name over as a parameter to your Mobile Service scripts. This allows you to perform different functionality in the same script based off of the parameter that is sent in.
Custom Parameters in Mobile Services - This post by Amit is similar to the one above by Josh and shows another example of how you can pass in a parameter to alter a scripts functionality. This one includes client side source code for a .NET app in addition to the server side script.
Dealing with Expired Channel URIs - In this post, Brian Hitney explains how to handle being notified about expired channel URIs (for push notifications) in your server side scripts. His code actually shows how to delete that channel URI using the mssql module in your scripts.
iOS In-App Purchases and Mobile Services - In this post, Josh walks through how you can implement a system for storing production information for in-app purchases, as well as verifying payments on those purchases, for iOS applications using Mobile Services.
Checking Tweets from a scheduled script – Yavor walks you through setting up a scheduled script which checks Twitter for related to skiing conditions in the Seattle area. This is all server side scripting and doesn’t affect the client.
Checking Tweets and sending push notifications – Nick walks through setting up a scheduled service which will check Twitter for tweets about a particular alias and will then perform a push notification with the information from that tweet.
Sending Push Notifications – A simple walkthrough for sending push notifications from a scheduled script. Code (for both the client and server side) includes C# for Windows Store and Windows Phone as well as Objective-C for iOS.
Backing up your DB - Josh walks though how to use a scheduled script to backup your Mobile Services database to blob storage as well as how to restore the database.
Periodic Notifications with Scheduler - Josh explains how you can use the scheduler to send periodic push notifications as well as how to refresh a tile (for Windows apps) for generic usage in those pushes.
Command Line Interface
Setting up the CLI tools and backing up Scripts – Using the Windows Azure Command Line Interface Tools, it’s possible to do many things including creating and setting up your Mobile Service, creating tables, and handling scripts. Here, Josh explains how to use the CLI tools to backup your scripts from Mobile Services to your local computer.
Syncing Server Scripts with local versions – Josh explains how to use Node to sync scripts between your local computer and your Mobile Service. Using this technique, you can make changes on your local computer and they’ll automatically be synced with your Mobile Service.
Creating a Log Watcher – A tutorial for setting up a Log Watcher using the CLI tools. This gives you the ability to see anything that has been logged to your Mobile Service (from the server side scripts) on your local computer without opening the portal.
Channel 9 Mobile Services Series – We recently added a new series of videos on Mobile Services to Channel 9 (a Microsoft website for video content). Most of the videos are over Windows Store apps but there is one (and will be more) iOS video and some of the videos are cover all platforms. Many of these videos are walkthroughs of the Dev Center tutorials.
Build Conference Mobile Services Videos – Josh Twist has a few videos and comments from his sessions at Microsoft’s Build 2012 conference. These videos demonstrate Josh building a pretty slick Windows Store client for Mobile Services.
Overview of the Mobile Services HTTP API - In this video Josh walks through the HTTP API behind mobile services. This is a great explanation of how data goes back and forth behind the scenes in the SDKs as well as how the Application key works.
NSScreenCast Chat App Part 1 - Part 1 of a 2 part series on using Windows Azure Mobile Services from popular iOS screencaster, NSScreenCast. In this episode, they start building a chat application by adding several features including authentication.
NSScreenCast Chat App Part 2 - Part 2 of a 2 part series on using Windows Azure Mobile Services from popular iOS screencaster, NSScreenCast. In this episode, they finish implementing a chat application as well as add push notifications into their app.
For now at least. As more interesting scenarios are realized and examples are created to demonstrate the solution, I’ll keep posting them. For now, this should cover a very large body of possibilities and questions when it comes to using Windows Azure Mobile Services in your applications. If you know of any samples or links that should be here, please let me know. As a reminder, if you haven’t already done so, you can sign up for a free Windows Azure account here.