Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CocoaHeadsUkraine 2017

CocoaHeadsUkraine 2017

Avatar for Andrew Skrypnik

Andrew Skrypnik

March 04, 2017
Tweet

More Decks by Andrew Skrypnik

Other Decks in Programming

Transcript

  1. frameworks From concepts to products 1. CoreLocation - where 2.

    CoreMotion - when 3. Background App Refresh - how
  2. Device preprocess first • All device API in hand •

    Ability to use new SDK features • Network optimization From concepts to products
  3. Apple Watch • only in foreground • low battery •

    data synchronize problem (steps/sleeps/etc) From concepts to products
  4. one hand gives the other takes From concepts to products

    • push notifications • emails • popups inside app
  5. From concepts to products • . • Э - -

    . , . Ч ?? • , "В ". • – э ш ( ш ). ( ) • Э . . . э ш . я .
  6. Permissions From concepts to products <key>NSLocationAlwaysUsageDescription</key> <string>Allow permissions for this

    app to ensure accurate tracking</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Allow permissions for this app to ensure accurate tracking</string>
  7. what is under the hood From concepts to products •

    start timers • when back to background
  8. Constants From concepts to products • Walking: • 20 min

    | 1.6 km | 80-140 gps • Automotive: • 30 min | 40 km | 90-150 gps
  9. guaranteed problems From concepts to products • CoreLocation is very

    noisy • You receiving points with inaccurate accuracy even if you set it • Cloudiness has a large affect for accuracy • Time-order for points • different hardware suppliers on same iPhone models
  10. Basic GPS Filter 1. Sort points by time 2. Accuracy

    filter From concepts to products
  11. Basic GPS Filter • Kalman filter • or • Catmullrom

    From concepts to products https://github.com/andrelind/swift-catmullrom
  12. Network 1. collect GPS to 15 points pool 2. calculate

    steps 3. calculate sleeps 1. additionally use phone locks/unlocks 4. use locks for determinate context 1. driver or passenger 2. use phone on work / home 5. 30 sec debounce for sending From concepts to products
  13. statistic From concepts to products 1. start time for work

    – 9:44 2. end time for work – 17:49 (18:03) 3. average commute to work – 1:03:30 4. average commute to home – 31:03 5. average logs per day – 16 6. GPS points in DB – 16.708.814 7. meets – 25641 8. :3