iOS8, Swift, Node.js, MQTT, NOSQL. This session will bring the developer on a journey that bridges the gap between the mobile device and the cloud using cutting edge technologies to build engaging applications focused on the "Lean Startup" mentality where developers can experiment with a variety of technologies and garner rapid feedback from their stakeholders. Using an open cloud environment and Apple’s introduction of the Swift Programming language, we can demonstrate how application development can be in the cloud and leverage core technologies such as NoSQL Data and Interactive Push Notifications to create compelling and engaging applications via MQTT while leveraging high scalable cloud infrastructure for hosting cloud based scripting technologies based upon Node.js.
2. 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
3. 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…
4. 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
5. 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
8. 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
9. 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
10. 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
10
https://github.com/BoltsFramework/Bolts-iOS Data CRUD
BlueList Storyboard
12. 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
13. 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
14. 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)];
}
}];
}
15. 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];
}
16. 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
17. 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.
18. Weather Service
• Server side integration logic
written in Node.js
• APIs get current weather for
store locations using 3rd party
weather service
19. 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
20. 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