(mbl302) mastering synchronization across mobile devices, login providers, and the web | aws...
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
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
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
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
Implementing a user profile that syncs across devices, OS, apps is hard.
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.
• Store App Data, Preferences and State
• Work Offline
• No Backend
User
Data
Identity Pool
• 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
• Store subscriptions
• Recall last article
• Bridge mobile and web
load last article
list of subscriptions
new subscription
synchronized
opens an article
synchronized
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
https://console.aws.amazon.com/cognito
//Create credentials provider and set it as default for all AWS services
AWSCognitoCredentialsProvider
credentialsWithRegionType
accountIdidentityPoolId
unauthRoleArn
authRoleArn
AWSServiceConfiguration
AWSServiceManager
AccountId
RoleArn
IdentityPoolId
config.region
config.credentials
logins
http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-
auth.html#setting-up-identity-provider-applications
accessToken
Logins
authRoleArn
//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
openOrCreateDataset
subs
data
put
synchronize
stringForKey
openOrCreateDataset
synchronize
lastViewed
displayArticle
1. Pull updates
2. Resolve conflicts
3. Push local updates
// always choose local changes
initWithLocalRecord
// choose highest value
conflict.localRecord.data.value.string integerValueconflict.remoteRecord.data.value.string integerValue
initWithLocalRecord
initWithRemoteRecord
conflicts.length
// always choose local changes
resolveWithLocalRecord
// choose highest value
getValue
resolveWithLocalRecord
resolveWithRemoteRecord
dataset.resolve
http://docs.aws.amazon.com/mobile/sdkforios/developerguid
e/cognito-sync.html#push-sync
datasetName datasets
existingDataset
mergedDataset
http://aws.amazon.com/cognito/
http://mobile.awsblog.com/blog/tag/amazon-cognito
https://forums.aws.amazon.com/forum.jspa?forumID=173
Please give us your feedback on this session.
Complete session evaluations and earn re:Invent swag.
http://bit.ly/awsevals
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