Slide 1

Slide 1 text

Developing Android App for Billions Paresh Mayani @pareshmayani

Slide 2

Slide 2 text

AboutMe.apk Paresh Mayani Founder/Organizer, GDG Ahmedabad Technical Lead @ Lets Nurture Application Architect

Slide 3

Slide 3 text

Emerging markets will be at the forefront of smartphone growth 80% of smartphone growth till 2019 Source : GSMA Intelligence

Slide 4

Slide 4 text

2016 2018 2019 Make your app work well regardless of how people are connected 2017 2020 47% 42% 37% 33% 29% 32% 32% 33% 34% 36% 21% 26% 29% 33% 36% Source : GSMA Intelligence 3G 4G 2G Share of mobile connections worldwide 100% 80% 60% 40% 20% 0% 1 Billion users will still be on 2G in 2020 1 Billion users will still be on 2G in 2020

Slide 5

Slide 5 text

Tailor your app experience to variations in mobile speed and connection quality Source : State of the Internet Report, Q4 2015 (Akamai) 15 UK KOR JPN IND ARG 30 22.5 7.5 Mobile Connectivity 0 AUS CHN IDN ZAF EGY SAU BRA CHL 50% 100% 75% 25% 0% VNM VEN % Above 4Mbps AVG Mbps

Slide 6

Slide 6 text

Good news: 4G is getting rolled out in India

Slide 7

Slide 7 text

But but it would take some time to reach to rural areas.... Source : Giphy.com

Slide 8

Slide 8 text

Help your users manage their data cost 3% AUS UK KOR EGY NGA 6% 4.5% 1.5% Post paid data prices (% of per capita GNI) Post paid data prices (% of per capita GNI) 0% Source : Measuring the Information Society Report 2015 (ITU) 4% 8% 6% 2% 0% HK CHN TH IDN MEX VNM IND BRA NOR HK UK NGA VNM AUS IDN BRA PHL IND EGY MEX KEN

Slide 9

Slide 9 text

Active Android Users 1.4 Billion

Slide 10

Slide 10 text

Developing for Billions Framework 1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce

Slide 11

Slide 11 text

Developing for Billions Framework 1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce

Slide 12

Slide 12 text

Prioritize traffic - text first De-duplicate network requests Adjust behavior by connection (For example, Youtube) Effective API Design (Avoid Select * ) Optimize networking

Slide 13

Slide 13 text

Load and Display TEXTUAL data first Load Images asynchronously Prioritize Traffic - Text First Note: Following this would help you in making your users busy in app, and meanwhile you load the data

Slide 14

Slide 14 text

Effective API Design At that moment when API developer writes “Select * from table” query and returns all the data in response

Slide 15

Slide 15 text

Send only required fields and avoid unnecessary details Most of the time enemy is Select * query Can optimize APIs with “Expiry date” or “Last updated” date Effective API Design

Slide 16

Slide 16 text

Optimize images Use Vector Images Serve dynamic image sizes No need to different sets of colored images, apply color filters Placeholder or low-resolution thumbnails can improve user experience

Slide 17

Slide 17 text

ImageView is 120x120 and image resolution is 1024x768 Purely injustice Image should be downscaled. Use some popular libraries like Glide. They provide caching mechanism, downscaling, thumbnailing, transformations, and what not. Serve dynamic image sizes

Slide 18

Slide 18 text

Load only Required size Cache Images Use Image loading libraries like Picasso, Glide, Fresco Serve dynamic image sizes

Slide 19

Slide 19 text

Note: Not a performance tip but a good practice in displaying UI Picasso library provides functionality to prioritize the image loading through priority(). priority() takes one of three constants, HIGH, MEDIUM, or LOW Load Images Priority wise

Slide 20

Slide 20 text

Useful Offline Experience Cache Image loading library

Slide 21

Slide 21 text

Because you know Internet sucks :) and Seeing “Loading…” dialog is boring Caching Data

Slide 22

Slide 22 text

Make your user’s busy Important: Display whatever data you have, meanwhile fetch required data Caching Data

Slide 23

Slide 23 text

Effective cache controls will dramatically reduce server load Cache data as much as possible, why? Less number of web requests => No use of network radio => Improved battery life Important: It will make user busy in reading something while loading new set of data Important: Don’t assume everyone has high speed connection in the world! Caching Data

Slide 24

Slide 24 text

Useful Offline Experience Test in airplane mode

Slide 25

Slide 25 text

Developing for Billions Framework 1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce

Slide 26

Slide 26 text

Screen Sizes Test with emulator configurations Build for small & medium screens Optimize for mdpi & hdpi Test with emulator configurations

Slide 27

Slide 27 text

Efficient Memory Usage Adjust footprint by available RAM ActivityManager.isLowRamDevice() ActivityManager.getMemoryClass() Avoid long-running processes

Slide 28

Slide 28 text

Memory Usage Android Studio memory monitor 512MB RAM 1GB RAM 12.51MB 36.39MB

Slide 29

Slide 29 text

Smart Storage Use Bounded caches Cache in getCacheDir() Allow install to SD card Measure via app settings

Slide 30

Slide 30 text

Backwards Compatibility targetSdkVersion 23 minSdkVersion 15 Android Support libraries Google Play services

Slide 31

Slide 31 text

1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce Developing for Billions Framework

Slide 32

Slide 32 text

Those big and bloated Apks...

Slide 33

Slide 33 text

Those big and bloated Apks... Remember everyone doesn’t have super fast network?

Slide 34

Slide 34 text

Those big and bloated Apks... Remember everyone doesn’t have super fast network? Then show me ways to Reduce Apk size?

Slide 35

Slide 35 text

APK Size Images are biggest offenders Reduce code size, use ProGuard Set following in build.gradle minifyEnabled=true shrinkResources=true Multi-APK as an option

Slide 36

Slide 36 text

Inspect Code...

Slide 37

Slide 37 text

Inspect Code... Remove unused resources Optimized code Improve performance

Slide 38

Slide 38 text

Analyze Apk

Slide 39

Slide 39 text

Analyze Apk

Slide 40

Slide 40 text

Analyze Apk To avoid 64K referenced method limit issues with your Dex files Diagnose ProGuard configuration issues View merged AndroidManifest.xml file inspect the compiled resources file (resources.arsc) Ensure your APK contains exactly the things you expect

Slide 41

Slide 41 text

Developing for Billions Framework 1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce

Slide 42

Slide 42 text

Battery Consumption Eliminate unneeded wakeups Batch network requests Use GcmNetworkManager API

Slide 43

Slide 43 text

Developing for Billions Framework 1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce

Slide 44

Slide 44 text

Fast & Responsive UI Touch feedback everywhere UI always interactive Always target 60 fps Consider launch screens Source : nkdroidsolutions.com

Slide 45

Slide 45 text

Implementing Ripple effect Layout - Set background CardView - Set foreground

Slide 46

Slide 46 text

Implementing Ripple effect TextView - selectableItemBackgroundBorderless ImageView - Use selectableItemBackgroundBorderless

Slide 47

Slide 47 text

Implementing Ripple effect - Button drawable-v21/ drawable/

Slide 48

Slide 48 text

Consider launch screens It’s a user’s first experience of your app Use a placeholder UI Or a branded launch screen

Slide 49

Slide 49 text

UI Best Practices Adhere to Material Design Use Design Support library

Slide 50

Slide 50 text

Localization Support your user’s locale User appropriate fonts (e.g. Noto)

Slide 51

Slide 51 text

Developing for Billions Framework 1.Connectivity 2.Device Capability 3.Data Cost 4.Battery Consumption 5.Content 6.Commerce

Slide 52

Slide 52 text

Monetization Advertisement In-App Purchase Subscription Paid App

Slide 53

Slide 53 text

Local Price Sub-dollar prices available in over 18 countries Helps offer locally affordable products

Slide 54

Slide 54 text

Bonus Tips

Slide 55

Slide 55 text

Introduction Screens Don’t assume your app’s all users are literate Guide your users Show Important features of your app

Slide 56

Slide 56 text

Prepare Wireframe/Mockups Because App Developers are not magicians...

Slide 57

Slide 57 text

Prepare Wireframe/Mockups

Slide 58

Slide 58 text

Don’t wait for your Users to submit Crash Reports At that moment when you users are saying app is being crashed

Slide 59

Slide 59 text

You would not come to know about crashes being faced by users, until they submit voluntarily Then how to get it automatically? Use tools like Crashlytics, Firebase, Crittercism, ACRA Don’t wait for your Users to submit Crash Reports

Slide 60

Slide 60 text

Use Version Control System Have developed scalable app Have proper architecture followed Use patterns => MVP / MVVM Use OkHttp, Retrofit, RxJava, RxAndroid More tips/best practices

Slide 61

Slide 61 text

Building for Billions Playbook g.co/play/billionsplaybook What’s Next ? Building for Billions Framework g.co/dev/billions

Slide 62

Slide 62 text

No Questions!

Slide 63

Slide 63 text

Thank you! Paresh Mayani @pareshmayani