lightning talk: mobile cloud jargon: why is my ios simulator not charging to 100%
TRANSCRIPT
Lightning Talk: Mobile Cloud Jargon: Why is my iOS simulator
not charging to 100%
Todd Kaplinger @todkap
Senior Technical Staff Member MobileFirst Cloud Platform Architect
Acme Apparel Application• Business to Consumer (B2C) • Advanced Application
• 15 Unique Views• 10 Persisted Data Objects
• Security Integration with OAUTH• Push Notifications Support • Integration with 3rd Party Weather Service• Twitter Social Integration • Operational Analytics calculating usage
patterns
Google+ Identity
Social Login Integration • Google+ Authentication • OAUTH2 Client Side Flow • Native iOS Libraries with Objective-C• OAUTH Providers
• Facebook• Google+• Twitter
• Authentication Scope • Profile
• Access to user profile info (email/preferred name/photo)
• Integrated with Advanced Mobile Access
/** * Executed when the Google+ authentication flow returns control to the application. */ - (void)finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) error { if(!error){ [self queryGooglePlusUser]; } }
/** * Fetch the authenticated user's Google+ information. */ -(void) queryGooglePlusUser { GTLServicePlus* plusService = [[GTLServicePlus alloc] init]; plusService.retryEnabled = YES; [plusService setAuthorizer:[GPPSignIn sharedInstance].authentication]; GTLQueryPlus *query = [GTLQueryPlus queryForPeopleGetWithUserId:@"me"]; [plusService executeQuery:query completionHandler:^(GTLServiceTicket *ticket,
GTLPlusPerson *person, NSError *error) { if (error) { GTMLoggerError(@"Error: %@", error); } else { [self buildCustomer:(person)]; } }]; }
Cloudant NoSQL Database• Cloudant NoSQL database provides data layer that is transparent and always
on • Client-side APIs provide intuitive environment for storing data on the cloud
• CRUD support, online and offline replication with only a few lines of code • Map simple objects to JSON documents using default or custom object mapper
• Object Models - Items, Shopping Cart, Stores, and Purchase History
Shopping Cart
/*! * Handles the logic for adding an item to the cart. */ -(void) addToCart:(Item *)itemToAdd withColor:(ColorObject*)color andSize:(NSString*)size
andItemURL:(NSString*)url { self.totalItems++; NSString *itemKey = [self generateKey:itemToAdd withColor:color.colorName andSize:size]; self.total = [self.total decimalNumberByAdding:itemToAdd.price]]; if ([self.itemsInCart keyExists:itemKey]) { CartItem *cartItem = (CartItem*)[self.itemsInCart objectForKey:itemKey]; cartItem.quantity++; return; } CartItem *newItem = [[CartItem alloc] initWithItem:itemToAdd andSize:size
andColor:color andCartKey:itemKey andItemURL:url]; [self.itemsInCart addObject:newItem forKey:itemKey]; }
/*! * Handles the logic for deleting an item from the cart. */ -(void)deleteFromCart:(NSInteger)itemIndex { CartItem *itemToDelete = [self.itemsInCart objectAtIndex:itemIndex]; self.totalItems = self.totalItems - itemToDelete.quantity; NSDecimalNumber *totalToDelete = [itemToDelete.item.price
decimalNumberByMultiplyingBy:itemToDelete.quantity]; self.total = [self.total decimalNumberBySubtracting:totalToDelete]; [self.itemsInCart removeObjectForKey:itemToDelete.cartKey]; }
Push Notification Integration• Customer subscribes to notifications
on order updates after logging in • Visual notifications
• Alerts appear to inform employee of a new purchase
- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
NSArray *tag = [NSArray arrayWithObjects:@"customerTag", nil]; IMFPushClient *pushService = [IMFPushClient sharedInstance]; pushService.environment = @"sandbox"; [pushService registerDeviceToken:deviceToken completionHandler:
^(IMFResponse *response, NSError *error) { if (nil != error){ NSLog(@"Error register device token with error: %@", error); } else { NSLog(@"Device has been registered with response: %@", response); [pushService subscribeToTags:tag completionHandler:
^(IMFResponse *response, NSError *error) { NSLog(@"Subscribed to tag with response: %@", response); }]; } }]; }
- (void)application:(UIApplication *)application didReceiveRemoteNotification: (NSDictionary *)userInfo
{ NSString *message = [[[userInfo valueForKey:@"aps"]
valueForKey:@"alert"] valueForKey:@"body"]; [UIApplication sharedApplication].applicationIconBadgeNumber =
[[[userInfo objectForKey:@"aps"] objectForKey:@"badgecount"] intValue]; [self showNotification:message]; if ([[[userInfo valueForKey:@"aps"] valueForKey:@"category"]
isEqualToString:@"PURCHASE_CHANGE"]){ if (application.applicationState == UIApplicationStateActive){ [[self notificationCenter] postNotificationName:@"Purchase_Change"
object:nil userInfo:userInfo]; [[PushService pushInstance] resetPushCounter]; } else if (application.applicationState == UIApplicationStateBackground
|| application.applicationState == UIApplicationStateInactive){ [[self notificationCenter] postNotificationName:@"Purchase_Change"
object:nil userInfo:userInfo]; [[PushService pushInstance] resetPushCounter]; } } }
• Notifies a customer if the status of her/his order has changed
• Data channel • Customers’ purchase statuses
are updated when the view is reloaded
• Full support for interactive notifications in iOS 8
• Uses tags and subscriptions to send targeted messages to customers
Location
• Device level APIs for obtaining user’s current location
• APIs map store locations in close proximity to the user
• User can denote preferred store location and obtain directions.
Weather Service
• Server side integration logic written in Node.js
• APIs get current weather for store locations using 3rd party weather service
Twitter Social Integration
• Server side integration logic written in NodeRed
• WebSocket APIs get current tweets for #fashion
• MQTT Client provides real time updates tailored to item being viewed in the catalog
Mobile Analytics
• Operational Analytics catered to the mobile app developer
• Request metrics are automatically captured for the various Mobile Cloud Services
• Capture mobile OS levels • Analyze errors by build,
device, etc.
Data Analytics
Push Analytics
Security Analytics