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

Building with Android O

Avatar for AndiGeeky AndiGeeky
October 01, 2017

Building with Android O

Android O has changed the way apps work in the background, and we talk about how to implement common app use cases in this new world, along with highlighting a few O features you should make sure to take advantage of.

Avatar for AndiGeeky

AndiGeeky

October 01, 2017
Tweet

More Decks by AndiGeeky

Other Decks in Programming

Transcript

  1. Who loves to build great android applications to make people’s

    life easier! Software Engineer Android freak With almost 4 years of experience in Android Mobile, TV, Wear, Beacons etc. Who loves to learn and expand horizon with sharing knowledge to people, just like me! Ultimate Learner Coming soon!! You have to wait for this!! Mamata Gelanee
  2. Release Graph March April May June July Q3 DP1 DP2

    DP3 DP4 Final Release Compatibility Check Build for Android O
  3. What’s new in Android O ➔ Background Execution limits ➔

    Picture-in-picture ➔ Notifications ➔ Lifecycle Architecture Components ➔ Fonts in XML & Downloadable Fonts ➔ Security And more Bonus API changes!
  4. Background Execution Limits 1 Background Services limitations It is Foreground

    service if, • Has a visible Activity • Another foreground app is connected to the app • Bounded to notification It is Background service if, • It is not foreground 2 Location update limitations App will receive background location updates, • few times per hour • No updates when your device connected to same static wifi 3 Broadcast Receivers limitations Implicit Broadcast, ACTION_PACKAGE_REPLACED Explicit Broadcast, ACTION_MY_PACKAGE_REPLAC ED Apps can not use their manifest to register Implicit Broadcast Wake Lock?
  5. Architecture Components Activity/Fragment ViewModel Repository Model Remote Data Source SQLite

    WebService LiveData Room Fuel ➔ Provides API for, ◆ Persist Data - Room ◆ Manage Lifecycle - LifeCycle Aware Components ◆ Observable Data - Live Data ◆ Retain Objects - ViewModel Robust, testable, maintainable apps...
  6. Fonts ➔ Boilerplate code: Fonts as Resources ➔ Increase in

    APK size : Downloadable Fonts ➔ Benefits ◆ Reduces APK size ◆ Increases the app installation success rate ◆ Improves the overall system health ◆ Android API versions > 14 App 1 App 2 App N Fonts Contract Font Provider Font Cache
  7. Fonts (contd..) 1 Legacy Way // Create a typeface Typeface

    typeface = Typeface.createFromAsset(getActivity() .getAssets(), "EncodeSansExpanded-Light.ttf"); // Apply a typeface textFont.setTypeface(typeface); 2 Fonts in XML <TextView android:fontFamily="@font/encode_s ans_expanded_light" ../> https://github.com/mamatagelanee07/CustomizedFontExamples
  8. Picture In Picture ➔ Run your activity in Pinned window

    ➔ Already available for Android TV, now on Android O mobile devices ➔ Check multi window life cycle <activity android:name="VideoActivity" android:resizeableActivity="true" android:supportsPictureInPicture="true" …/> getActivity().enterPictureInPictureMode();
  9. Notification Channels A named category of notification from one app

    that share the same behaviour so the user can understand and control them. User Discounts Deals Booking Remainders
  10. Notifications Channels ➔ Notification Badges ➔ Snoozing ➔ Timeout ➔

    App Settings / Android Settings ➔ Attention Based sorting
  11. Notifications Attention Based sorting Major Ongoing People to people General

    BTW (By The Way) Maps, Music, Phone Messages, Whatsapp Remainders, Mails Weather, Traffic info.
  12. Security ➔ Settings.Secure.ANDROID_ID ◆ Different value for each app, each

    user ◆ package name and signing key ◆ Use ADVERTISING_ID instead ➔ android.os.Build.SERIAL is deprecated for Android O and newer versions ◆ Build.getSerial() ◆ Build.SERIAL will be “UNKNOWN” ➔ No longer support of SSLv3 ➔ Permissions ➔ GET_ACCOUNTS use AccountManager#newChooseAccountIntent() instead
  13. Bonus Tips ➔ Auto sizing TextView ➔ findViewById() ➔ Emoji

    Compacts ➔ Multiple Display Mode ➔ Adaptive Icons ➔ Physics based Animations ➔ Autofill framework <TextView app:autoSizeTextType="uniform" ../> TextView textView = (TextView) findViewById(R.id.text);
  14. Social Connect Software Engineer, Mastercard Transaction solution pvt. Ltd., Vadodara

    - Gujarat AndiGeeky andigeeky.com/ @MamataGelanee mamatagelanee07