(mbl302) mastering synchronization across mobile devices, login providers, and the web | aws...

46

Upload: amazon-web-services

Post on 24-Jun-2015

737 views

Category:

Technology


1 download

DESCRIPTION

In the past, content and preferences would be moved to the device. Now devices are just a window to content and services that live in the cloud. The cloud enables your content and preferences to follow you wherever you go. You have the ability to transition between your phone, tablet, and laptop and seamlessly pick up where you left off. With Amazon Cognito, you can synchronize user data across mobile OS/devices and bridge the web world with the mobile world. In this session, learn how you can implement sync in Android, iOS, and JavaScript so you can deliver a ''WOW'' customized user experience to your customers. We show you how to integrate with Amazon Cognito to sync with mobile devices and the web and delve into some of the nuances of syncing, such as conflict resolution and account merging.

TRANSCRIPT

Page 1: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 2: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Today Thursday Friday

MBL201 – Device

Clouds 11:00 AM

MBL302 – Cognito

Sync 2:15 PM

MBL301 – Amazon

SNS 3:30 PM

MBL303 – Mobile

Analytics 4:30 PM

MBL401 – Cognito

Identity 3:15 PM

MBL304 – HTC &

EasyTaxi 4:30 PM

MBL310 – iOS

Workshop 9:00 AM

MBL311 – Android

Workshop 9:00 AM

Highly Recommended

3-hour Free

Workshops

MBL305 – Second

Screen SNS 2:15 PM

WEB203 – Web &

Cognito 5:30 PM

Page 3: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 4: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 5: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Manage authenticated

and guest users across

identity providers

Guest

Identity Management

Synchronize user’s data

across devices and

platforms via the cloud

Data Synchronization

Securely access AWS

services from mobile

devices and platforms

Secure AWS Access

Page 6: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Manage authenticated

and guest users across

identity providers

Guest

Identity Management

Synchronize user’s data

across devices and

platforms via the cloud

Data Synchronization

Securely access AWS

services from mobile

devices and platforms

Secure AWS Access

MBL401

Page 7: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Implementing a user profile that syncs across devices, OS, apps is hard.

Page 8: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 9: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Concrete Software has been making hit mobile games

like Jellyflop and PBA Bowling Challenge since 2003.

With Amazon Cognito, We

can build games much faster

and provide great user

experience to our customers.

Keith A. Pichelman

CEO, Concrete Software

“• Provide a seamless user experience across devices

and platforms to our users.

• Store save games in the cloud and synchronize them

across all of a user’s devices without creating or

hosting a backend.

The Challenge

The solution

• Amazon Cognito helps us securely access our AWS

resources.

• Cognito Sync gives us flexibility to save data in the

cloud, and cache it on a user’s devices, without

managing any backend infrastructure.

Page 10: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 11: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 12: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 13: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 14: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 15: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

• Store App Data, Preferences and State

• Work Offline

• No Backend

User

Data

Identity Pool

Page 16: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

• Identity Pool: Pool of app users. Can be

shared across apps.

• Identity: An individual user. Consistent

across identity providers. Can be a guest

user.

• Dataset: Per user grouping of data. The

most granular level of sync. Up to 1 MB.

• Record: Key/Value pair.

AWS Account

Dataset

IdentityIdentityIdentity

DatasetDataset

Identity

Pool

1:60

1:n

1:20

DatasetDataset

Record

1:1024

Page 17: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 18: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

• Store subscriptions

• Recall last article

• Bridge mobile and web

Page 19: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

load last article

list of subscriptions

new subscription

synchronized

opens an article

synchronized

Page 20: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 21: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

End Users

App with

AWS Mobile

SDK

Access

to AWS

Services

1. Login 2. Get Access Token

4. Cognito ID, Temp Credentials

3. Access Token, Pool ID, Role ARNs

Cognito ID

(Temp

Credentials)

Cognito Identity/STS

1. Last open

article

2. List of

subscriptionsCognito Sync

5. Sync Data

Page 22: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

https://console.aws.amazon.com/cognito

Page 23: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

//Create credentials provider and set it as default for all AWS services

AWSCognitoCredentialsProvider

credentialsWithRegionType

accountIdidentityPoolId

unauthRoleArn

authRoleArn

AWSServiceConfiguration

AWSServiceManager

Page 24: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

AccountId

RoleArn

IdentityPoolId

config.region

config.credentials

Page 25: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

logins

http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-

auth.html#setting-up-identity-provider-applications

Page 26: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

accessToken

Logins

authRoleArn

Page 27: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

//Create sync client and open dataset

AWSCognito defaultCognito

AWSCognitoDataset openOrCreateDataset " "

//Create a json string containing subscriptions

NSArray *subsArr = @[@"sports.rss", @"science.rss", @"tech.rss"];

NSData *subsData = [NSJSONSerialization dataWithJSONObject:subsArr options:0 error:nil];

NSString *subsJson= [[NSString alloc] initWithData:subsDataencoding:NSUTF8StringEncoding];

//Save subscriptions and last viewed and synchronize dataset with the cloud

setString forKey " "

setString " " forKey " "

synchronize

Page 28: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

openOrCreateDataset

subs

data

put

synchronize

Page 29: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

stringForKey

Page 30: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

openOrCreateDataset

synchronize

lastViewed

displayArticle

Page 31: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 32: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

1. Pull updates

2. Resolve conflicts

3. Push local updates

Page 33: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 34: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

// always choose local changes

initWithLocalRecord

// choose highest value

conflict.localRecord.data.value.string integerValueconflict.remoteRecord.data.value.string integerValue

initWithLocalRecord

initWithRemoteRecord

Page 35: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

conflicts.length

// always choose local changes

resolveWithLocalRecord

// choose highest value

getValue

resolveWithLocalRecord

resolveWithRemoteRecord

dataset.resolve

Page 36: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 37: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

http://docs.aws.amazon.com/mobile/sdkforios/developerguid

e/cognito-sync.html#push-sync

Page 38: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 39: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 40: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

datasetName datasets

existingDataset

mergedDataset

Page 41: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 42: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 43: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014
Page 44: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

http://aws.amazon.com/cognito/

http://mobile.awsblog.com/blog/tag/amazon-cognito

https://forums.aws.amazon.com/forum.jspa?forumID=173

Page 45: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Please give us your feedback on this session.

Complete session evaluations and earn re:Invent swag.

http://bit.ly/awsevals

Page 46: (MBL302) Mastering Synchronization Across Mobile Devices, Login Providers, and the Web | AWS re:Invent 2014

Today Thursday Friday

MBL201 – Device

Clouds 11:00 AM

MBL302 – Cognito

Sync 2:15 PM

MBL301 – Amazon

SNS 3:30 PM

MBL303 – Mobile

Analytics 4:30 PM

MBL401 – Cognito

Identity 3:15 PM

MBL304 – HTC &

EasyTaxi 4:30 PM

MBL310 – iOS

Workshop 9:00 AM

MBL311 – Android

Workshop 9:00 AM

Highly Recommended

3-hour Free

Workshops

MBL305 – Second

Screen SNS 2:15 PM

WEB203 – Web &

Cognito 5:30 PM