35
06.11.15 @braintree_dev @alanhhwong Building an Invisible App Alan Wong <developer-advocate/> PayPal & Braintree

Building an Invisible App

Embed Size (px)

Citation preview

Page 1: Building an Invisible App

06.11.15

@braintree_dev @alanhhwong

Building an Invisible App

Alan Wong <developer-advocate/>

PayPal & Braintree

Page 2: Building an Invisible App

>since 2013

@braintree_dev @alanhhwong

Page 3: Building an Invisible App
Page 4: Building an Invisible App
Page 5: Building an Invisible App
Page 6: Building an Invisible App
Page 7: Building an Invisible App
Page 8: Building an Invisible App
Page 9: Building an Invisible App
Page 10: Building an Invisible App

20% of all apps are used only ONCE!

http://info.localytics.com/blog/app-retention-improves

Page 11: Building an Invisible App

http://readwrite.com/2012/01/17/study_average_app_session_lasts_about_1_minute

Average App Session Lasts About 1 Minute

Page 12: Building an Invisible App
Page 13: Building an Invisible App

How do you make this count?

Page 14: Building an Invisible App

Background Services

Page 15: Building an Invisible App
Page 16: Building an Invisible App
Page 17: Building an Invisible App
Page 18: Building an Invisible App

1. Location

2. Read Calendar

3. Calculate commute

4. Display Notification

Page 19: Building an Invisible App

> Location

>Significant-change location service

>Background location services

- (void)startSignificantChangeUpdates { // Create the location manager if this object does not // already have one. if (nil == locationManager) locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; [locationManager startMonitoringSignificantLocationChanges]; }

Page 20: Building an Invisible App

// Delegate method from the CLLocationManagerDelegate protocol. - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation* location = [locations lastObject]; NSDate* eventDate = location.timestamp; NSTimeInterval howRecent = [eventDate timeIntervalSinceNow]; if (abs(howRecent) < 15.0) { // If the event is recent, do something with it. NSLog(@"latitude %+.6f, longitude %+.6f\n", location.coordinate.latitude, location.coordinate.longitude); } }

> Location

>Significant-change location service

>Background location services

Page 21: Building an Invisible App

EKEventStore *store = [store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error)

{ // handle access here }];

// Get the appropriate calendar NSCalendar *calendar = [NSCalendar currentCalendar];

// Create the start date components NSDateComponents *oneDayAgoComponents = [[NSDateComponents alloc] init]; oneDayAgoComponents.day = -1; NSDate *oneDayAgo = [calendar dateByAddingComponents:oneDayAgoComponents toDate:[NSDate date] options:0];

// Create the end date components NSDateComponents *oneYearFromNowComponents = [[NSDateComponents alloc] init]; oneYearFromNowComponents.year = 1; NSDate *oneYearFromNow = [calendar dateByAddingComponents:oneYearFromNowComponents toDate:[NSDate date] options:0];

// Create the predicate from the event store's instance method NSPredicate *predicate = [store predicateForEventsWithStartDate:oneDayAgo endDate:oneYearFromNow calendars:nil];

// Fetch all events that match the predicate NSArray *events = [store eventsMatchingPredicate:predicate];

> Read Calendar Event

> Get access -> retrieve event

Page 22: Building an Invisible App

MKDirectionsRequest *walkingRouteRequest = [[MKDirectionsRequest alloc] init]; walkingRouteRequest.transportType = MKDirectionsTransportTypeWalking; [walkingRouteRequest setSource:[startPoint mapItem]]; [walkingRouteRequest setDestination :[endPoint mapItem]];

MKDirections *walkingRouteDirections = [[MKDirections alloc] initWithRequest:walkingRouteRequest];

[walkingRouteDirections calculateDirectionsWithCompletionHandler: ^(MKDirectionsResponse * walkingRouteResponse, NSError *walkingRouteError) { if (walkingRouteError) { [self handleDirectionsError:walkingRouteError]; } else { self.walkingRoute = walkingRouteResponse.routes[0]; } }];

> Calculate Commute

> With location + destination, use Map Kit (MKDirections) to compute ETA

Page 23: Building an Invisible App

- (IBAction)setNotification:(UIButton *)sender { UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.fireDate = dateTime; notification.alertBody = @“Time to leave!"; notification.soundName = UILocalNotificationDefaultSoundName; notification.applicationIconBadgeNumber = 1; [[UIApplication sharedApplication] scheduleLocalNotification:notification]; }

> Display Notification

> Use local notification

Page 24: Building an Invisible App

1. Tokenization

2. Vault

Page 25: Building an Invisible App

> Tokenizing Cardholder Data

Card Number Card Verification Code

Expiration Date ..}

c32bk4g98Ad32 ...

> Vault

> Securely store payment method using the nonce

> Create a transaction using stored payment methods

Page 26: Building an Invisible App
Page 27: Building an Invisible App
Page 28: Building an Invisible App

FIVE Things To Consider

Page 29: Building an Invisible App

1. Don’t automate everything

Page 30: Building an Invisible App
Page 31: Building an Invisible App

2. Use Notifications

Page 32: Building an Invisible App

3. Usage Patterns

Page 33: Building an Invisible App

4. Make Use of Location

Page 34: Building an Invisible App

5. Establish Trust

Page 35: Building an Invisible App

06.11.15

@braintree_dev @alanhhwong

Thank you.Questions?Alan Wong <developer-advocate/>

PayPal & Braintree