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

Surviving Mobile Constraints

Surviving Mobile Constraints

This is a lightning talk I gave for the “Mobile Lightning” event at Philly Tech Week 2012.

Matt Thomas

April 25, 2012

Transcript

34 slides
  1. June 29, 2007 2 Quad Core Processors @ 3.0GHz 1

    Single Core Processor @ 412 MHz 1GB - 32GB RAM 128MB RAM Gigabit Ethernet Edge & WiFi Up to 8 2560x1600 Displays One 3½ Inch 320x480 Display
  2. iOS Beware of Watchdog • Watchdog is a process that

    ensures apps play nice within these constraints. • It will kill your app if it takes up too many resources. animalsbeingdicks.com
  3. Limited Memory • On iOS, there’s no swap file. •

    20MB*, you get memory warnings. • 30MB*, watchdog kills your app. *These can vary based on device, apps running, etc…
  4. Limited Memory • Always test on the device: • Simulator

    doesn’t have memory constraints. • Profile memory usage: • “Allocations” instrument on iOS • iOS - Check for memory leaks Test
  5. Limited Memory • Cache judiciously: • NSCache on iOS. •

    getCacheDir() on Android. • Download large files directly to disk: • NSFileHandle on iOS • DownloadManager on Android Tips
  6. Slow Processor • Complex operations will take more time. •

    Long operations can block the UI. • iOS - Watchdog will kill an app if it blocks the main thread for > 30 seconds. • Exception: 0x8badf00d (ate bad food).
  7. Slow Processor • Test on Device: • iOS - Simulator

    will run at native processor speed. • Profile slow code: • iOS - “Timer Profiler” instrument. • View methods by time how long they take. Test
  8. Slow Processor • Familiarize yourself with concurrency: • iOS -

    NSOperation. • iOS - Grand Central Dispatch. • Android - AsyncTask. • Both Android and iOS have specific threads that UI updates must be called on. Tips
  9. Battery Life • This is a major issue with many

    factors: • CPU/GPU usage. • Antennas: Cellular, WiFi, GPS, Bluetooth. • Screen Brightness. • etc…
  10. Battery Life • iOS - You can test this! •

    Profile with the “Energy Diagnostics” instrument. • Always profile while on battery power! • See “Instruments User Guide” for more details Test
  11. Slow Network • User may have a super slow network

    connection. • User may not even have a network connection. • User may often often lose connection. • Most users may have a cellular data cap!
  12. Slow Network • Hard to test all network situations. •

    Do real world testing as much as possible. • iOS - Network Link Conditioner system preference can simulate different network conditions. Test
  13. Slow Network • Don’t assume anything about the network connection.

    • Fail Gracefully. It will fail for someone. • Avoid UI blocking networking: • iOS - sendSynchronousRequest Tips
  14. Small Screen • Expect screens between 3½ and 5 inches.

    • Fingers are larger and less precise than mice: • iOS - 44 square points recommended for controls.
  15. Small Screen • Always do user testing. • User may

    interact through accessibility controls: • Test these too! Test
  16. Small Screen • Re-prioritize what is important & keep only

    what is needed. • Minimize screen space used for branding or unnecessary elements. • Grouping & hierarchy become very important: • iOS - UINavigationController Tips
  17. Small Screen • Hide controls when they’re not needed •

    Find interesting uses for gestures • Scrolling and panning is fun. Take advantage of it. (e.g. Twitter) Tips
  18. Why? “…more iOS devices were sold in 2011… than all

    the Macs ever sold” - asymco.com “There are more Android activations every day than babies born on earth” - Robert Kyncl, YouTube
  19. Why? Mobile is popular! It is just beginning to bloom.

    It is leading innovation… despite these constraints.

More Decks by Matt Thomas

Other Decks in Programming