building an invisible app
TRANSCRIPT
![Page 1: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/1.jpg)
06.11.15
@braintree_dev @alanhhwong
Building an Invisible App
Alan Wong <developer-advocate/>
PayPal & Braintree
![Page 2: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/2.jpg)
>since 2013
@braintree_dev @alanhhwong
![Page 3: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/3.jpg)
![Page 4: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/4.jpg)
![Page 5: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/5.jpg)
![Page 6: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/6.jpg)
![Page 7: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/7.jpg)
![Page 8: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/8.jpg)
![Page 9: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/9.jpg)
![Page 10: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/10.jpg)
20% of all apps are used only ONCE!
http://info.localytics.com/blog/app-retention-improves
![Page 11: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/11.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/12.jpg)
![Page 13: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/13.jpg)
How do you make this count?
![Page 14: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/14.jpg)
Background Services
![Page 15: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/15.jpg)
![Page 16: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/16.jpg)
![Page 17: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/17.jpg)
![Page 18: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/18.jpg)
1. Location
2. Read Calendar
3. Calculate commute
4. Display Notification
![Page 19: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/19.jpg)
> 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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/20.jpg)
// 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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/21.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/22.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/23.jpg)
- (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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/24.jpg)
1. Tokenization
2. Vault
![Page 25: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/25.jpg)
> 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](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/26.jpg)
![Page 27: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/27.jpg)
![Page 28: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/28.jpg)
FIVE Things To Consider
![Page 29: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/29.jpg)
1. Don’t automate everything
![Page 30: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/30.jpg)
![Page 31: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/31.jpg)
2. Use Notifications
![Page 32: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/32.jpg)
3. Usage Patterns
![Page 33: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/33.jpg)
4. Make Use of Location
![Page 34: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/34.jpg)
5. Establish Trust
![Page 35: Building an Invisible App](https://reader031.vdocuments.mx/reader031/viewer/2022022202/58847ccd1a28ab5e248b7511/html5/thumbnails/35.jpg)
06.11.15
@braintree_dev @alanhhwong
Thank you.Questions?Alan Wong <developer-advocate/>
PayPal & Braintree