Top Banner
Accelerating Mobile Application Development with Mobile Cloud Services Todd Kaplinger Senior Technical Staff Member MobileFirst for iOS Cloud Architect @todkap © 2015 IBM Corporation
22
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Interconnect Mobile Application Development on Bluemix!!

Accelerating Mobile Application Development with Mobile Cloud ServicesTodd Kaplinger Senior Technical Staff Member MobileFirst for iOS Cloud Architect @todkap

© 2015 IBM Corporation

Page 2: Interconnect Mobile Application Development on Bluemix!!

The new normal of IT focus and investment…

Three methods of new value creation:

Alone, each of these has immense potential. Integrated, they change everything.

Drive people-centric Engagement for new profit

channels

Utilize Data as the new basis

of competitive advantage

Leverage Cloud as growth engine

for business

Page 3: Interconnect Mobile Application Development on Bluemix!!

Building “engaging” apps is hard• Time to market requirements must be quicker… weeks not

months

• More experimental in nature… LEAN approaches to testing the market are needed.

• Mobile brings its own set of challenges… from device fragmentation to scale to surges of demand to connecting securely into enterprise data

• Greater data capture requirements… on all apps to drive analytics

• Developers of engaging apps want to use multiple languages and Cloud APIs…

Page 4: Interconnect Mobile Application Development on Bluemix!!

The IBM MobileFirst Platform contains the ingredients for a successful mobile program

Available on premises or in the cloud.

Efficiently Develop & Integrate

Easily Secure

Personalize Engagements

Continuously Deliver

Page 5: Interconnect Mobile Application Development on Bluemix!!

The three essential ingredients to building apps for the “new normal”

A platform to secure your apps, manage their

lifecycle, and integrate them into the enterprise

Cloud APIs that can be glued together to quickly create new apps at scale

Synchronized data across devices that can scale to

meet mobile demand

Page 6: Interconnect Mobile Application Development on Bluemix!!

MobileFirst Apps for iOS

Page 7: Interconnect Mobile Application Development on Bluemix!!

Swift + iOS8Simple TODO Application

Page 8: Interconnect Mobile Application Development on Bluemix!!

BlueList Application• Bluemix Hosted • Leverages MobileFirst Services Starter

Boilerplate • Cloudant NoSQL DB • Push for iOS 8 • Advanced Mobile Access • Linked identity to data stored in cloud

Bluemix

Google+ Identity

Custom Authentication

Facebook Authentication

Page 9: Interconnect Mobile Application Development on Bluemix!!

BlueList Application• Simple TODO list for tracking outstanding

items • Focus on Swift version designed for iOS8 • CocoaPods used for dependency

management • Available on command line via GIT

DevOps

CocoaPods

GIT Hosted on DevOps

Page 10: Interconnect Mobile Application Development on Bluemix!!

BlueList in Swift Variant of BlueList Mobile Data written in Swift Simple TODO list for tracking outstanding items

(IBM_Item.swift Class)(2 ViewControllers / One AppDelegate / One Storyboard)

Leverages Bolts Framework to simplify data access patterns

10https://github.com/BoltsFramework/Bolts-iOS Data CRUD

BlueList Storyboard

Page 11: Interconnect Mobile Application Development on Bluemix!!

DEMO

Page 12: Interconnect Mobile Application Development on Bluemix!!

Acme Apparel Application• Business to Consumer (B2C) • Advanced Application

• 15 Unique Views• 10 Persisted Data Objects

• Security Integration with Mobile First Platform Advanced Mobile Access

• Push Notifications Support • Integration with 3rd Party Weather Service• MQA sentiment analysis and crash reporting • Operational Analytics calculating usage

patterns

Google+ Identity

Page 13: Interconnect Mobile Application Development on Bluemix!!

Advanced Mobile Access• MobileFirst Services Starter

(for iOS 8) • Authentication options

• Facebook • Google+ • Custom authentication

• Register iOS app using bundle id and version

• Custom authentication set up through predefined REST API

• Use Apple Touch ID to secure MobileFirst access tokens

Page 14: Interconnect Mobile Application Development on Bluemix!!

Social Integration • Google+ Authentication • OAUTH2 Client Side Flow • Native iOS Libraries with

Objective-C • 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)]; } }]; }

Page 15: Interconnect Mobile Application Development on Bluemix!!

Cloudant NoSQL Database• Fully managed 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]; }

Page 16: Interconnect Mobile Application Development on Bluemix!!

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

Page 17: Interconnect Mobile Application Development on Bluemix!!

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.

Page 18: Interconnect Mobile Application Development on Bluemix!!

Weather Service

• Server side integration logic written in Node.js

• APIs get current weather for store locations using 3rd party weather service

Page 19: Interconnect Mobile Application Development on Bluemix!!

Mobile Quality Assurance

• Admin dashboard on Bluemix • Pre-production or production

SDKs • Capture device metrics with

every bug report • Analyze errors by build, device,

etc.

MQA Dashboard

AcmeApparel

AcmeApparel

Page 20: Interconnect Mobile Application Development on Bluemix!!

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

Page 21: Interconnect Mobile Application Development on Bluemix!!

DEMO

Page 22: Interconnect Mobile Application Development on Bluemix!!

Thank You!Todd Kaplinger

@todkap

© 2015 IBM Corporation