"Living in background" by Andrey Skrypnik

"Living in background" by Andrey Skrypnik

During last year Andrey with his team was working hard on creating comprehensive tracking application to enhance user's health & productivity. To achieve smooth user experience he has to manage working in background — seamless network updates, reading sensors data, regions monitoring etc. In this talk Andrey will focus on issues he has faced, expectations vs reality, implementation pitfalls and on the Swift aspect of the application. The last but not least thing to cover will be battery usage — Andrey will reveal some patterns to optimize battery usage even with intensive work with sensors.

This talk was made for CocoaHeads Kyiv #11 which took place March 04 2017.

Db84cf61fdada06b63f43f310b68b462?s=128

CocoaHeads Ukraine

March 09, 2017
Tweet

Transcript

  1. LIVING IN BACKGROUND From concepts to products

  2. Soul Time Tracker – Log Your Day Automatically From concepts

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

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

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

    data synchronize problem (steps/sleeps/etc) From concepts to products
  6. New in CoreMotion From concepts to products • OLD •

    NEW
  7. one hand gives the other takes From concepts to products

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

    . , . Ч ?? • , "В ". • – э ш ( ш ). ( ) • Э . . . э ш . я .
  9. OKAY From concepts to products • OKAY

  10. 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>
  11. Capabilities From concepts to products

  12. App Store Page From concepts to products

  13. potential reject From concepts to products

  14. what is under the hood From concepts to products

  15. what is under the hood From concepts to products •

    start timers • when back to background
  16. what is under the hood From concepts to products

  17. Constants From concepts to products • Walking: • 20 min

    | 1.6 km | 80-140 gps • Automotive: • 30 min | 40 km | 90-150 gps
  18. 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
  19. CLRegion From concepts to products

  20. Source GPS From concepts to products

  21. Basic GPS Filter 1. Sort points by time 2. Accuracy

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

    From concepts to products https://github.com/andrelind/swift-catmullrom
  23. still sad From concepts to products

  24. Soul & Moves From concepts to products

  25. 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
  26. Network From concepts to products

  27. Battery From concepts to products

  28. 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
  29. Logger & AEConsole From concepts to products https://github.com/ConcepterDev/ShakeLog/ pod ShakeLog

  30. Thanks :3 • andrew@concepter.co • concepter.co/soul • github.com/ConcepterDev/ShakeLog/ • github.com/andrelind/swift-catmullrom

    •linkedin.com/in/andrewskrypnik From concepts to products