• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Colombo Mobile Developer MeetUp - Building Scalable Cloud Connected Mobile Apps using Windows Azure
 

Colombo Mobile Developer MeetUp - Building Scalable Cloud Connected Mobile Apps using Windows Azure

on

  • 315 views

 

Statistics

Views

Total Views
315
Views on SlideShare
315
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Colombo Mobile Developer MeetUp - Building Scalable Cloud Connected Mobile Apps using Windows Azure Colombo Mobile Developer MeetUp - Building Scalable Cloud Connected Mobile Apps using Windows Azure Presentation Transcript

    • Building Scalable Cloud ConnectedMobile Apps using Windows AzureJahufar Sadique (99X)
    • What is Windows Azure MobileServices?• A set of services build on Azure that provides backend ‘plumbing’ toyour mobile apps.• Focus on building apps and not backend logic– Data (dynamic schema)– Authentication (Federated identities such as Facebook, Google,Twitter, Windows Live)– Server Logic (via Mobile Services Server Scripts)– Push Notifications (GCM, APNS, WNS)• Monitoring/Analytics/Logging infrastructure• Client SDKs supported for Android, iOS, Windows Phone andHTML/Javascript
    • Getting Started• The service is not free• ..but comes with a 3 month free trial (subjectto credit card verification)• What you get:http://www.windowsazure.com/en-us/pricing/free-trial/
    • • DEMO: Azure Dashboard• DEMO: Creating a new mobile service• DEMO: Download the SDK and setup project
    • Mobile Service: Data• Backend is Windows Azure SQL Database• Dynamic schema – create your model in code,and the fields are mapped by magic• Throttling and failures are automaticallyhandled.• NO RELATIONS (i.e. no foreign keys, cascadelogic etc)
    • DEMOCreating a simple list of users
    • Authentication• Authenticate against: Facebook, Google,Twitter, Windows Live• Table level permissions for CRUD operations:– Everyone (default)– Only authenticated users– Only scripts and admins
    • DEMOSecuring the list of users
    • Server Scripts• Similar to a trigger• Allows you to build custom business logic whensomething happens to your data• Available operations: insert, update, read, delete (del)e.g.:function insert (id, user, request) {request.execute();}
    • Server Scripts: ContinuedInsert: function insert(item, user, request) { }Update: function update(item, user, request) { }Delete: function del(id, user, request) { }Read: function read(query, user, request) { }•Script functions always take 3 arguments:– 2ndarg is always “user” (represents a user)– 3rdarg is always “request” (used to send responses).– 1starg changes according to operation
    • Scripts: Continued• Example:function insert(item, user, request) {if (item.userId !== user.userId) {request.respond(statusCodes.FORBIDDEN, ‘Access Denied.);} else {request.execute();}}* Complete script reference can be found at:http://msdn.microsoft.com/en-us/library/windowsazure/jj554226.aspx
    • Push Notifications• Allows direct push to devices• Supported push services:– GCM (API key required)– APNS (Certificate required)– WNS (Client secret & Package SID required)N.B: For Windows Phone/WNS: 500 notifications/per user/per day.
    • Implementing Push Notifications(in 5 easy steps)Code walkthrough
    • Push Notifications: Step 1Register App for Notifications• GCM is the native push system for Android• Register your app and enable GCM usingGoogle API console(https://code.google.com/apis/console/)
    • Push Notifications: Step 2Configure Mobile Services• Copy generated API key from Google APIServices• Select ‘Push’ from Azure Console and pastekey
    • Push Notifications: Step 3Integrate push library to your app• Copy gcm.jar to libs• Add permissions<permission android:name=“com.test.permission.C2D_MESSAGE" android:protectionLevel="signature" /><uses-permission android:name=“com.test.permission.C2D_MESSAGE" /><uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /><uses-permission android:name="android.permission.GET_ACCOUNTS" /><uses-permission android:name="android.permission.WAKE_LOCK" />• Add reciever/services<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"android:permission="com.google.android.c2dm.permission.SEND"><intent-filter><action android:name="com.google.android.c2dm.intent.RECEIVE" /><action android:name="com.google.android.c2dm.intent.REGISTRATION" /><category android:name=“com.test" /></intent-filter></receiver><service android:name=".GCMIntentService" />
    • Push Notifications: Step 4Register your device & handle pushes• Assuming you have ‘deviceId’ field on your data model:String deviceId = GCMRegistrar.getRegistrationId(this);Users.deviceId = deviceId;//save here• When a push arrives, onMessage fires:protected void onMessage(Context context, Intent intent) {//notify user etc.}http://developer.android.com/google/gcm/gs.html
    • Push Notifications: Step 5Getting the server to notifyfunction insert(item, user, request) {request.execute({ success: function() {request.respond();push.gcm.send(Users.deviceId, item.text);}}
    • Diagnostics, Logging and Scale• Diagnostics:– CPU Time– Memory consumptions– API calls/time taken per request• Logging– With server scripts via console.x (console.info,console.error etc)• Scale– Scale up or down by spinning up new VMs or byscaling up VM size
    • More Services• Scheduler– Schedule server scripts on demand or on interval– Examples:• Purge old data,• Poll/aggregate data from other sources• Schedule pushes to be sent at a certain time• SendGrid (3rdparty service)– Email-As-A-Service• Pusher (3rdparty service)– Enhanced push services (among other things)
    • Thank you