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

Developing Android App for Billions

Paresh Mayani
September 10, 2016

Developing Android App for Billions

Talk on "Developing Android application for Billions" delivered in DevFest Pune 2016 and DevFest Baroda 2016.

This deck is having android best practices to be followed and keep in mind while developing android applications.

Paresh Mayani

September 10, 2016

More Decks by Paresh Mayani

Other Decks in Technology


  1. Emerging markets will be at the forefront of smartphone growth

    80% of smartphone growth till 2019 Source : GSMA Intelligence
  2. 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
  3. 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
  4. But but it would take some time to reach to

    rural areas.... Source : Giphy.com
  5. 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
  6. Prioritize traffic - text first De-duplicate network requests Adjust behavior

    by connection (For example, Youtube) Effective API Design (Avoid Select * ) Optimize networking
  7. 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
  8. Effective API Design At that moment when API developer writes

    “Select * from table” query and returns all the data in response
  9. 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
  10. 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
  11. 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
  12. Load only Required size Cache Images Use Image loading libraries

    like Picasso, Glide, Fresco Serve dynamic image sizes
  13. 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
  14. Make your user’s busy Important: Display whatever data you have,

    meanwhile fetch required data Caching Data
  15. 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
  16. Screen Sizes Test with emulator configurations Build for small &

    medium screens Optimize for mdpi & hdpi Test with emulator configurations
  17. Those big and bloated Apks... Remember everyone doesn’t have super

    fast network? Then show me ways to Reduce Apk size?
  18. 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
  19. 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
  20. Fast & Responsive UI Touch feedback everywhere UI always interactive

    Always target 60 fps Consider launch screens Source : nkdroidsolutions.com
  21. Implementing Ripple effect <RelativeLayout android:id="@+id/rlCarDetailsPUC" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground"> <android.support.v7.widget.CardView android:layout_width="match_parent"

    android:layout_height="wrap_content" app:cardCornerRadius="@dimen/dimen_5_dp" android:foreground="?attr/selectableItemBackground" app:cardElevation="@dimen/common_card_elevation" app:cardUseCompatPadding="true"> Layout - Set background CardView - Set foreground
  22. Implementing Ripple effect <TextView . . android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" /> <ImageView

    . . . android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" /> TextView - selectableItemBackgroundBorderless ImageView - Use selectableItemBackgroundBorderless
  23. Implementing Ripple effect - Button <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android"

    android:color="@color/colorPrimaryDark"> <item android:drawable="@color/colorPrimary" /> </ripple> <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@color/colorPrimaryDark"/> <item android:drawable="@color/colorPrimary"/> </selector> drawable-v21/ drawable/
  24. Consider launch screens It’s a user’s first experience of your

    app Use a placeholder UI Or a branded launch screen
  25. Introduction Screens Don’t assume your app’s all users are literate

    Guide your users Show Important features of your app
  26. Don’t wait for your Users to submit Crash Reports At

    that moment when you users are saying app is being crashed
  27. 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
  28. 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