Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

2,464 views

Published on

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.

Published in: Technology

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

  1. 1. Today Thursday Friday MBL201–Device Clouds11:00 AM MBL302–Cognito Sync 2:15 PM MBL301–Amazon SNS 3:30 PM MBL303–Mobile Analytics 4:30 PM MBL401–Cognito Identity3:15 PM MBL304–HTC & EasyTaxi4:30 PM MBL310–iOS Workshop9:00 AM MBL311–Android Workshop9:00 AM Highly Recommended 3-hour Free Workshops MBL305–Second Screen SNS 2:15 PM WEB203–Web & Cognito 5:30 PM
  2. 2. 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
  3. 3. 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
  4. 4. Implementing a user profile that syncs across devices, OS, apps is hard.
  5. 5. 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 Cognitohelps us securely access our AWS resources. •CognitoSync gives us flexibility to save data in the cloud, and cache it on a user’s devices, without managing any backend infrastructure.
  6. 6. •Store App Data,Preferences and State •Work Offline •No Backend User Data Identity Pool
  7. 7. •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 Identity Identity Identity Dataset Dataset Identity Pool 1:60 1:n 1:20 Dataset Dataset Record 1:1024
  8. 8. •Store subscriptions •Recall last article •Bridge mobile and web
  9. 9. loadlast article list of subscriptionsnew subscription synchronizedopens an article synchronized
  10. 10. 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 subscriptions Cognito Sync 5. Sync Data
  11. 11. https://console.aws.amazon.com/cognito
  12. 12. //Create credentials provider and set it as default for all AWS services AWSCognitoCredentialsProvider credentialsWithRegionType accountIdidentityPoolId unauthRoleArn authRoleArn AWSServiceConfigurationAWSServiceManager
  13. 13. AccountId RoleArn IdentityPoolIdconfig.regionconfig.credentials
  14. 14. logins http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito- auth.html#setting-up-identity-provider-applications
  15. 15. accessTokenLoginsauthRoleArn
  16. 16. //Create sync client and open dataset AWSCognitodefaultCognito AWSCognitoDatasetopenOrCreateDataset"" //Create a jsonstring containing subscriptions NSArray *subsArr= @[@"sports.rss", @"science.rss", @"tech.rss"]; NSData *subsData= [NSJSONSerializationdataWithJSONObject:subsArroptions:0 error:nil]; NSString *subsJson= [[NSString alloc] initWithData:subsDataencoding:NSUTF8StringEncoding]; //Save subscriptions and last viewed and synchronize dataset with the cloudsetStringforKey"" setString""forKey"" synchronize
  17. 17. openOrCreateDatasetsubsdataputsynchronize
  18. 18. stringForKey
  19. 19. openOrCreateDatasetsynchronizelastViewed displayArticle
  20. 20. 1. Pull updates 2. Resolve conflicts 3. Push local updates
  21. 21. // always choose local changesinitWithLocalRecord // choose highest valueconflict.localRecord.data.value.stringintegerValueconflict.remoteRecord.data.value.stringintegerValueinitWithLocalRecordinitWithRemoteRecord
  22. 22. conflicts.length // always choose local changesresolveWithLocalRecord // choose highest valuegetValueresolveWithLocalRecordresolveWithRemoteRecorddataset.resolve
  23. 23. http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-sync.html#push-sync
  24. 24. datasetNamedatasetsexistingDatasetmergedDataset
  25. 25. http://aws.amazon.com/cognito/ http://mobile.awsblog.com/blog/tag/amazon-cognitohttps://forums.aws.amazon.com/forum.jspa?forumID=173
  26. 26. Please give us your feedback on this session. Complete session evaluations and earn re:Invent swag. http://bit.ly/awsevals
  27. 27. Today Thursday Friday MBL201–Device Clouds11:00 AM MBL302–Cognito Sync 2:15 PM MBL301–Amazon SNS 3:30 PM MBL303–Mobile Analytics 4:30 PM MBL401–Cognito Identity3:15 PM MBL304–HTC & EasyTaxi4:30 PM MBL310–iOS Workshop9:00 AM MBL311–Android Workshop9:00 AM Highly Recommended 3-hour Free Workshops MBL305–Second Screen SNS 2:15 PM WEB203–Web & Cognito 5:30 PM

×