Getting your next Android project right - Gilad Haimov, Mobile Edge

22
Getting Your Next Mobile Project Right! Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Transcript of Getting your next Android project right - Gilad Haimov, Mobile Edge

Page 1: Getting your next Android project right - Gilad Haimov, Mobile Edge

Getting Your Next Mobile Project Right!

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 2: Getting your next Android project right - Gilad Haimov, Mobile Edge

About Me:

Gilad Haimov

7 years Mobile Developer

Lectures on Mobile Tech in Israel & Abroad

CEO of Mobile Edge Ltd.

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 3: Getting your next Android project right - Gilad Haimov, Mobile Edge

Will Cover:

1. Mobile Resource Management

2. Expected User Experience

3. Correct Test Methodologies

4. Server Push

5. BASS for Server Side

6. Create in-house Libraries

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 4: Getting your next Android project right - Gilad Haimov, Mobile Edge

Will NOT Cover:

- Universal Truth

- Low level Programmatical Best Practices

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 5: Getting your next Android project right - Gilad Haimov, Mobile Edge

1. Respect Resources Device

- Battery

- RAM

- CPU

Battery Over-Consumption = consistently major reason for uninstalling apps

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 6: Getting your next Android project right - Gilad Haimov, Mobile Edge

1. Respect Resources Device – Cont.

Battery Drainers:

- GPS

- Networking (Continuous bursts!)

- OpenGL Animations

- CPU Processing

Golden Rule: Remember to turn off!

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 7: Getting your next Android project right - Gilad Haimov, Mobile Edge

1. Respect Resources Device – Cont.

- Memory: - Load only when needed; Remove when not - Special care for image loading - Use DDMS regularly - Use Weak Reference Containers - Set android:largeHeap=True - Run large memory components of dedicated

processes

- CPU: - Offload heavy calculations to server - Give medium/low priority to CPU-bound threads - Cache intermediate results

Golden Rule: Load/Calculate only What you Need!

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 8: Getting your next Android project right - Gilad Haimov, Mobile Edge

2. User Experience – Be Slick

Mobile Users are Spoiled! Will Expect The Best

- Responsiveness - Slick UI - Smooth Animations - Smooth Scrolling (vert/horiz)

- Best Practice: Keep UI Thread for user interactions only: - Delegate heavy duty tasks to other threads - AsyncTask - Executers - Use Strict Mode for Testing

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 9: Getting your next Android project right - Gilad Haimov, Mobile Edge

2. User Experience – Be Slick

- Awareness - location related Data - Friend Related Data - Immediate Update!

Case Study: Passive Location Provider + Pre-fetching

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 10: Getting your next Android project right - Gilad Haimov, Mobile Edge

2. User Experience – Be Special!

Give Features and Capabilities Others Do Not

- Hidden APIs – Unpublished Capabilities• CB• BT Services• Tethering• Access HDMI Port• Read Internal SMS DB

- Use Latest OS Features

- Rely on Non-Global Hardware (NFC)

- Requires: Code Branching; OS Sources

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 11: Getting your next Android project right - Gilad Haimov, Mobile Edge

2. User Experience – Be Special!

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 12: Getting your next Android project right - Gilad Haimov, Mobile Edge

3. Mobile Testing

Remember: Interleave into Development Process From Start!

- Create a deployment Matrix - Popular Devices - Future Devices

- Test for Mobile Special Conditions: - Incoming Call/SMS - Network Interface Switch - LifeCycle Shifts: Home/Back/Task-Switch - Analyze CPU/Memory Usage - Screen On/Off. Lock-Screen On/Off.

- Use External Tools - DDMS - Robotium - Agilent

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 13: Getting your next Android project right - Gilad Haimov, Mobile Edge

4. Server Push is Your Friend

- Will always do smarter treatment of small buffer transmission

over your own server

- Don't use if low latency is required (real time transmission)

- Don't use for large packet

- Other than this: just open an XMPP channel from your server to

e.g. Google GCM servers and let them handle per device notifications

- Prefer JSON over XML -- 40-60% less CPU required for parsingMobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 14: Getting your next Android project right - Gilad Haimov, Mobile Edge

5. BAAS Server Side Solutions

- BAAS = Backend As A Service - Storage - Configuration - Biz Logic - Security, load Balancing, Fail Over..

- Vendors: - Parse - StackMob - Kinvy - Mobile Backend Starter (Google)

- Typically: No need for Backend developer

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 15: Getting your next Android project right - Gilad Haimov, Mobile Edge

6. In-House Libraries

For Complex Problems:

(BT Connect Logic)

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 16: Getting your next Android project right - Gilad Haimov, Mobile Edge

6. In-House Libraries - Cont

- Do so when Copy/Paste is not an Option

- Consider open Sourcing for the Community

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 17: Getting your next Android project right - Gilad Haimov, Mobile Edge

6. In-House Libraries - Cont

- Do so when Copy/Paste is not an Option

- Consider open Sourcing for the Community

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 18: Getting your next Android project right - Gilad Haimov, Mobile Edge

6. Cross-Platform Frameworks

Have Realistic Expectations!

- Cross OS platform sounds great

- Allow for web-like prototyping of app

- Latency problem

- VERY bad memory management

- Considered low-end solution

- More popular in the past where experienced native developers where hard to find

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 19: Getting your next Android project right - Gilad Haimov, Mobile Edge

6. Cross-Platform Frameworks – Cont.

Have Realistic Expectations!

- Platforms: - PhoneGap – use WebKit renderer

- Titanium: Pre-compiled to native

- Xamarin: Native UI, biz logic only; dotNet dev env

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 20: Getting your next Android project right - Gilad Haimov, Mobile Edge

6. Cross-Platform Frameworks – Cont.

An Alternative:

- Use one platform (Android) as golden-copy and diff changes to update the other platform

- Work in cycles of Fix and Match. Use a diff tool!

- In-house Results: - 2nd platform will take ~ half the time to Develop - Change consistency near 100%

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 21: Getting your next Android project right - Gilad Haimov, Mobile Edge

Questions?

Mobile Edge | www.mobileEdge.co.il | all rights reserved |

Page 22: Getting your next Android project right - Gilad Haimov, Mobile Edge

Thank You!

Mobile Edge | www.mobileEdge.co.il | all rights reserved |