Tag Archives: #MADSkills

Architecture MAD Skills series wrap up

Posted by Manuel Vicente Vivo, Developer Relations Engineer

MADSkills Jetpack DataStore 

Now that our MAD Skills series on Architecture is complete, let’s do a quick wrap up of all the things we’ve covered in each episode!

Episode 1 — The data layer

Learn about the data layer and its two basic components: repositories and data sources. We'll also cover data immutability, error handling, threading, testing and more tricks and recommendations with Jose Alcérreca.


Episode 2 — The UI layer

Learn about the UI layer and its state. Tunji Dahunsi covers UI state representation, production and consumption all within the context of a unidirectional data flow app!


Episode 3 — Handling UI events

Learn all about UI events. I—Manuel Vivo—cover the different types of UI events, the best practices for handling them, and more!


Episode 4 — The domain layer

The Domain layer is an optional layer which sits between the UI and Data layers. Don Turner explains how the domain layer can simplify your app architecture, making it easier to understand and test.


Episode 5 — Organizing modules

Emily Kager shares a tip around organizing modules in Android apps.


Episode 6 — Entities

Garima Jain shares a tip about creating separate data models based on various Architecture layers in your project.


Q&A

Tunji Dahunsi, Miłosz Moczkowski, Yigit Boyar, and I hung out together in a live Q&A session to answer all the questions you had!

Jetpack DataStore – wrap up

Posted by Simona Stojanovic, Android Developer Relations Engineer

MADSkills Jetpack DataStore 

Now that our MAD Skills series on Jetpack DataStore is complete, let’s do a quick wrap up of all the things we’ve covered in each episode:


Episode 1 — Introduction to Jetpack DataStore

We started with the basics of Jetpack DataStore — how it works and the changes and improvements it brings compared to SharedPreferences. We also discussed how to decide between its two implementations, Preferences and Proto DataStore, as well as how to choose between DataStore and Room.

Check out the blog post and the video:


Episode 2 — All about Preferences DataStore

Go deeper into Preferences DataStore: how to create it, read, and write data and how to handle exceptions, all of which should, hopefully, provide you with enough information to decide if it’s the right choice for your app.

Here’s the blog post and the video:


Episode 3 — All about Proto DataStore

Learn about Proto DataStore: how to create it, read, and write data and how to handle exceptions, to better understand the scenarios that make Proto a great choice.

If you prefer reading, here’s the blog post, otherwise, here’s the video:


Episode 4 — DataStore-serialization, sync work, and dependency injection

Episode 4 introduces several different concepts related to DataStore to understand how it works under the hood, so that you have everything at your disposal to use it in a production environment. We focus on: Kotlin Data class serialization, synchronous work, and dependency injection with Hilt.

Take a look at our blogs and video:

DataStore and dependency injection

DataStore and Kotlin serialization

DataStore and synchronous work


Episode 5 — DataStore-handling data migration and testing

Finally, in the fifth episode of our Jetpack DataStore series, we cover two additional concepts around DataStore: DataStore-to-DataStore migrations and testing. Hopefully, this will provide you all the information you need to add DataStore to your app successfully.

Check out the blogs and the video:

DataStore and data migration

DataStore and testing

MAD Skills Gradle and AGP build APIs Wrap Up!

Posted by Murat Yener, Android Developer Advocate

MAD Skills graphic

That’s a wrap! We’ve just finished a new MAD skills series on Gradle and Android Gradle plugin build APIs. In this series we shifted gears and took a look at how you can extend your build by using Gradle and brand new Android Gradle plugin APIs.

We covered how Gradle works, how you can configure the Android Gradle plugin, and learned which APIs to use to help customize your builds and keep your builds fast and efficient. If you missed this series or some of the episodes, here is a quick recap of what to expect.

Episode 1: Configure your build - Intro to Gradle and AGP

Gradle is a general purpose build tool which can build specific project types by using plugins. Plugins introduce a way to configure the build and decide which tasks are needed to build that project. Gradle configures and executes these tasks in different phases. Understanding how the build phases work and how to configure the Android Gradle plugin can help you customize your build according to your project’s needs and keep build times efficient.

You can check out the following video or if you prefer, read the article.


Episode 2: How to write a plugin

Extending your build by writing your own plugin gives you a way to customize your build even further! Starting with version 7.0, Android Gradle Plugin now offers stable extension points for manipulating variant configuration and the produced build artifacts. In this episode we started with writing a custom task and used the new Variant API to initialize and modify properties of Variants.

You can find the same content in article form.


Episode 3: Taking your plugin to the next step

As we saw in previous episodes, keeping your config phase fast and resolving values lazily can help keep your builds efficient. Providers and Properties let you pass inputs and receive outputs from Gradle tasks lazily. In this episode we also take a look at the new Artifacts API to access and modify the app manifest.

Check out the article or the following video.


Episode 4: Gradle and AGP Build APIs Community Tip

In the last episode in the series, we feature Alex Saveau, who maintains the Gradle Play Publisher and Version Orchestrator plugins. Alex shares a tip on using modern AGP and Gradle APIs to manipulate Android build artifacts.

To learn more, check out the following video.


Episode 6: Live Q&A

Finally, we wrapped up this series with a live Q&A session where we answered your questions. If you missed the Q&A, make sure to check out the following recording.


If you are interested to learn more, make sure to check out the resources and the Gradle recipes repo linked below! See you in the next MAD Skills series.

Recipes repo: https://github.com/android/gradle-recipes

Extend the Android Gradle plugin: https://developer.android.com/studio/build/extend-agp

AGP Roadmap: https://goo.gle/3EuNYXz

MAD Skills Navigation Series 2 Wrap Up!

Posted by Murat Yener

It’s a wrap!! We’ve just finished the second series of Navigation on MAD Skills. In this series, we re-visited Chet’s DonutTracker app and added an important missing feature: the ability to track coffee.

With new functionality comes new responsibilities. While we added coffee tracking, we also improved the navigation experience, implemented conditional navigation, modularized the app and finally learned what is changing with multiple back stack support.

Episode 1: NavigationUI

As new destinations were added to the app,we used NavigationUI to offer a better navigation UI experience. NavigationUI helped us automatically integrate NavigationView and BottomNavigationView with the existing menu ids for destinations. You can check out the video linked below or if you prefer read the article here.

Episode 2: Conditional Navigation

We added coffee tracking functionality in the first episode but no matter whether users disable or enable the coffee tracker, they could still navigate to the CoffeeList fragment. In this episode, we fixed that by adding conditional navigation and directing our users to make a selection when they launch the app for the first time.

You can find the same content in article form here.

Episode 3: Nested Graphs and Include

In the third episode, we took a step back and organized the navigation graph by using nested graphs and using the include tag to import other graphs. While keeping our project more organized, this also allowed us to modularize the app and see how navigation works with modules. Check out the article or the video below.

Episode 4: Feature Modules

In the fourth episode, we took the app a step further and converted the coffee module to a feature module. With this change, the coffee tracking feature will only be downloaded and installed for users who enabled this feature. Dynamic features allowed us to modularize the app to save network and storage for the user. To learn more, check out the video linked below or if you prefer read the article here.

Episode 5: Multiple Back Stacks

In this episode, we covered a highly requested feature, multiple back stack support for Navigation. To support multiple back stacks, all you need to do is to update your navigation and fragment dependencies. You can observe multiple back stack behavior with NavigationView and BottomNavigationView instantly without any code change!

You can also find the same content in article form here.

Episode 6: Live Q&A

Finally, we wrapped up the second series of Navigation with a live Q&A session where we answered your questions. If you missed the Q&A, make sure to check out the recording below.

Sample Apps

Donut and Coffee Tracker

The application used for the first 4 episodes in the series is the DonutTracker app which Chet built during the first Navigation series on MAD Skills. You can follow the progress in each episode by checking out the starter and solution code from this repo.

Navigation Advanced Sample

This project is used to demonstrate Multiple back stack support in Navigation. Before Navigation version 2.4.0-alpha01, this project offered NavigationExtensions to mimic the multiple back stack behavior. You can check out the solution code with updated dependencies and NavigationExtensions removed in this repo.

This brings an end to the second Navigation series but the MAD series will continue with another exciting topic! Make sure you stay tuned for more Android MADness!

MAD Skills Navigation Series 2 Wrap Up!

Posted by Murat Yener

It’s a wrap!! We’ve just finished the second series of Navigation on MAD Skills. In this series, we re-visited Chet’s DonutTracker app and added an important missing feature: the ability to track coffee.

With new functionality comes new responsibilities. While we added coffee tracking, we also improved the navigation experience, implemented conditional navigation, modularized the app and finally learned what is changing with multiple back stack support.

Episode 1: NavigationUI

As new destinations were added to the app,we used NavigationUI to offer a better navigation UI experience. NavigationUI helped us automatically integrate NavigationView and BottomNavigationView with the existing menu ids for destinations. You can check out the video linked below or if you prefer read the article here.

Episode 2: Conditional Navigation

We added coffee tracking functionality in the first episode but no matter whether users disable or enable the coffee tracker, they could still navigate to the CoffeeList fragment. In this episode, we fixed that by adding conditional navigation and directing our users to make a selection when they launch the app for the first time.

You can find the same content in article form here.

Episode 3: Nested Graphs and Include

In the third episode, we took a step back and organized the navigation graph by using nested graphs and using the include tag to import other graphs. While keeping our project more organized, this also allowed us to modularize the app and see how navigation works with modules. Check out the article or the video below.

Episode 4: Feature Modules

In the fourth episode, we took the app a step further and converted the coffee module to a feature module. With this change, the coffee tracking feature will only be downloaded and installed for users who enabled this feature. Dynamic features allowed us to modularize the app to save network and storage for the user. To learn more, check out the video linked below or if you prefer read the article here.

Episode 5: Multiple Back Stacks

In this episode, we covered a highly requested feature, multiple back stack support for Navigation. To support multiple back stacks, all you need to do is to update your navigation and fragment dependencies. You can observe multiple back stack behavior with NavigationView and BottomNavigationView instantly without any code change!

You can also find the same content in article form here.

Episode 6: Live Q&A

Finally, we wrapped up the second series of Navigation with a live Q&A session where we answered your questions. If you missed the Q&A, make sure to check out the recording below.

Sample Apps

Donut and Coffee Tracker

The application used for the first 4 episodes in the series is the DonutTracker app which Chet built during the first Navigation series on MAD Skills. You can follow the progress in each episode by checking out the starter and solution code from this repo.

Navigation Advanced Sample

This project is used to demonstrate Multiple back stack support in Navigation. Before Navigation version 2.4.0-alpha01, this project offered NavigationExtensions to mimic the multiple back stack behavior. You can check out the solution code with updated dependencies and NavigationExtensions removed in this repo.

This brings an end to the second Navigation series but the MAD series will continue with another exciting topic! Make sure you stay tuned for more Android MADness!

MAD Skills WorkManager : Wrap-Up

Posted by Caren Chang, Developer Relations Engineer

In case you missed it, we’ve just finished a MAD Skills series on WorkManager. We started by introducing WorkManager for those new to the library and then proceeded to talk more about advanced usages including how to test and debug your WorkManager code. The series ended with an episode on how to migrate your old code from GCMNetworkManager and FirebaseJobDispatcher to use WorkManager instead.

Here’s a quick summary of what we covered.

Episode 1: WorkManager: Basics

In our first episode, we explored the basics of WorkManager through the WorkManager codelab. We started by understanding how to define work we want done, and how to schedule the work. We then moved on to implementing different types of work: unique and periodic. Finally, we ended the episode by taking a look at app standby buckets to better understand how WorkManager schedules work.

If you’re new to WorkManager, we also recommend taking a look at the following articles:

Episode 2: WorkManager: Working in the background

The series continued with Ben giving a more in-depth look at how WorkManager deals with multi-threading. When working with threads, you have the option of using Executors, coroutines or RxJava, and Ben demonstrated each of these approaches with WorkManager. The episode concluded by demonstrating how to return a result when the work is completed so that the UI can be updated.

If you’re interested in using WorkManager with coroutines, we also recommend this article from Florina: WorkManager - Kotlin APIs

Episode 3: WorkManager: Advanced configuration and testing

In episode 3, we took a look at how to customize the initialization of WorkManager and support apps that span multiple processes. We’ve gotten a lot of questions from developers around testing and debugging, so Ben also dove into how to test your Workers, and useful debugging techniques.

Episode 4: Migrating from GCM NetworkManager and FirebaseJobDispatcher to WorkManager

In episode 4, we focused on how to migrate from old job scheduling libraries (GCMNetworkManager and FirebaseJobDispatcher) to WorkManager. Once your app starts targeting API level 30 and above, GCM NetworkManager and FirebaseJobDispatcher will no longer work on devices running Android Marshmallow (6.0) and above. If your app is still using either of those libraries, now is the time to update your apps to use WorkManager instead!

Episode 5: WorkManager with Hugo

Android GDE Hugo Visser talked about why he chose to use WorkManager in a health app he recently worked on and how the library has helped his development process.

Episode 6: Live Q&A

The series wrapped up with a live Q&A session where we answered your WorkManager related questions. Watch the recording to see all your questions answered, including future plans for WorkManager, handling duplicate work, retrying failed work, and more!

MAD Skills Kotlin and Jetpack: wrap-up

Posted by Florina Muntenescu, Developer Relations Engineer

Kotlin and Jetpack image

We just wrapped up another series of MAD Skills videos and articles - this time on Kotlin and Jetpack. We covered different ways in which we made Android code more expressive and concise, safer, and easy to run asynchronous code with Kotlin.

Check out the episodes below to level up your Kotlin and Jetpack knowledge! Each episode covers a specific set of APIs, talking both about how to use the APIs but also showing how APIs work under the hood. All the episodes have accompanying blog posts and most of them link to either a sample or a codelab to make it easier to follow and dig deeper into the content. We also had a live Q&A featuring Jetpack and Kotlin engineers.

Episode 1 - Using KTX libraries

In this episode we looked at how you can make your Android and Jetpack coding easy, pleasant and Kotlin-idiomatic with Jetpack KTX extensions. Currently, more than 20 libraries have a KTX version. This episode covers some of the most important ones: core-ktx that provides idiomatic Kotlin functionality for APIs coming from the Android platform, plus a few Jetpack KTX libraries that allow us to have a better user experience when working with APIs like LiveData and ViewModel.

Check out the video or the article:

Episode 2 - Simplifying APIs with coroutines and Flow

Episode 2, covers how to simplify APIs using coroutines and Flow as well as how to build your own adapter using suspendCancellableCoroutine and callbackFlow APIs. To get hands-on with this topic, check out the Building a Kotlin extensions library codelab.

Watch the video or read the article:

Episode 3 - Using and testing Room Kotlin APIs

This episode opens the door to Room, peeking in to see how to create Room tables and databases in Kotlin and how to implement one-shot suspend operations like insert, and observable queries using Flow. When using coroutines and Flow, Room moves all the database operations onto the background thread for you. Check out the video or blog post to find out how to implement and test Room queries. For more hands-on work - check out the Room with a view codelab.

Episode 4 - Using WorkManager Kotlin APIs

Episode 4 makes your job easier with WorkManager, for scheduling asynchronous tasks for immediate or deferred execution that are expected to run even if the app is closed or the device restarts. In this episode we go over the basics of WorkManager and look a bit more in depth at the Kotlin APIs, like CoroutineWorker.

Find the video here and the article here, but nothing compares to practical experience so go through the WorkManager codelab.

Episode 5 - Community tip

Episode 5 is by Magda Miu - a Google Developer Expert on Android who shared her experience of leveraging foundational Kotlin APIs with CameraX. Check it out here:

Episode 6 - Live Q&A

In the final episode we launched into a live Q&A, hosted by Chet Haase, with guests Yigit Boyar - Architecture Components tech lead, David Winer - Kotlin product manager, and developer relations engineers Manuel Vivo and myself. We answered questions from you on YouTube, Twitter and elsewhere.

What’s your MAD score?

Posted by Christopher Katsaros; Your #MADscore tabulator

We’ve been talking to you a lot recently about modern Android development (MAD), through the MAD Skills series. Now it’s time to see: what’s your MAD score? From how many Jetpack libraries you’re using to what percent of your app is coded in Kotlin, today we’re launching a MAD scorecard that shows just how modern an Android developer you are.

Your MAD scorecard uses Android Studio to tell you interesting things like how much size savings your app is seeing through the Android App Bundle. It spotlights each of the key MAD technologies, including specific Jetpack libraries and Kotlin features you could be using. You’ll even get a special MAD character based on your MADest skill (who knows, you just might be a MAD scientist…).

Here’s how to get your scorecard

You can get a personalized look into your MAD score through a new Android Studio plugin, here’s how to get and share your scorecard:

  • Step 1 - Install the plugin: Through Android Studio’s plugin marketplace, find and download the MAD Scorecard plugin. Install easily and quickly through your Studio.
  • Step 2 - Run the plugin: You can always find your MAD Scorecard plugin under Analyze in your main Studio menu. Click on Analyze, and Run to start creating your very own Scorecard.
  • Step 3 - View and share your scorecard: When you’ve completed running the plugin, Studio will show you a notification with your personal link where you can view all the details of your scorecard. Enjoy your results and share it with others!

Level up with the MAD Skills series

Once you’re done with your scorecard, check out the episodes in MAD Skills, a series of videos and articles we’re creating to teach you how to use the latest technologies of Modern Android Development to create better applications more easily. Arranged as a series of three-week topics, from Navigation to Kotlin to Android Studio, each topic will conclude with a Q&A where we’ll answer your questions. You can check out some of our earlier topics, like Material Design Components, App Bundles, and Navigation, and tune into Android Developers on YouTube for future topics.

See your MAD scorecard and share it with all of your friends, here!

MAD Skills Material Design Components: Wrap-Up

Posted by Nick Rout

wrap up header image

It’s a wrap_content!

The third topic in the MAD Skills series of videos and articles on Modern Android Development is complete. This time around we covered Material Design Components (a.k.a MDC). This library provides the Material Components as Android widgets and makes it easy to implement design patterns seen on material.io, such as Material Theming, Dark Theme, and Motion.

Check out the episodes and links below to see what we covered. We designed these videos to closely follow our recent series of MDC articles as well as existing sample apps and codelabs, so you’ve got a variety of ways to engage with the content. We also had a Q&A episode featuring engineers from the MDC team!

Episode 1: Why use MDC?

The first episode by Nick Butcher is an overview video of this entire MAD Skills series, including why we recommend MDC, then deep-dives on Material Theming, Dark Theme and Motion. It also covers MDC interop with Jetpack Compose and updates to Android Studio templates that include MDC and themes/styles best practices.

Or in article form:

https://medium.com/androiddevelopers/we-recommend-material-design-components-81e6d165c2dd

Episode 2: Material Theming

Episode 2 by Nick Rout covers Material Theming and goes through a tutorial on how to implement it on Android using MDC. Key topics include setting up a `Theme.MaterialComponents.*` app theme, choosing color, type, and shape attributes — using tools on material.io —and finally adding them to your theme to see how widgets automatically react and adapt their UI. Also covered are handy utility classes that MDC provides for certain scenarios, like resolving theme color attributes and applying shape to images.

Or in article form:

https://medium.com/androiddevelopers/material-theming-with-mdc-color-860dbba8ce2f

https://medium.com/androiddevelopers/material-theming-with-mdc-type-8c2013430247

https://medium.com/androiddevelopers/material-theming-with-mdc-shape-126c4e5cd7b4

Episode 3: Dark Theme

This episode by Chris Banes gets really dark… It takes you through implementing a dark theme for an Android app using MDC. Topics covered include using “force dark” for quick conversion (and how to exclude views from this), manually crafting a dark theme with design choices, `.DayNight` MDC app themes, and `.PrimarySurface` MDC widget styles, and how to handle the system UI.

Or in article form:

https://medium.com/androiddevelopers/dark-theme-with-mdc-4c6fc357d956

Episode 4: Material Motion

Episode 4 by Nick Rout is all about Material’s motion system. It closely follows the steps in the existing “Building Beautiful Transitions with Material Motion for Android” codelab. It uses the Reply sample app to demonstrate how you can use transition patterns —container transform, shared axis, fade through, and fade —for a smoother, more understandable user experience. It goes through scenarios involving Fragments (including the Navigation component), Activities, and Views, and will feel familiar if you’ve used the AndroidX and platform transition frameworks before.

Or in article form:

https://medium.com/androiddevelopers/material-motion-with-mdc-c1f09bb90bf9

Episode 5: Community tip

Episode 5 is by a member of the Android community—Google Developer Expert (GDE) for Android Zarah Dominguez—who takes us through using the MDC catalog app as a reference for widget functionality and API examples. She also explains how it’s been beneficial to build a ‘Theme Showcase’ page in the app she works on, to ensure a cohesive design language across different screens and flows.

Episode 6: Live Q&A

To wrap things up, Chet Haase hosted us for a Q&A session along with members of the MDC engineering team —Dan Nizri and Connie Shi. We answered questions asked by you on YouTube Live, Twitter, and elsewhere. We explored the origins of MDC, how it relates to AppCompat, and how it’s evolved over the years. Other topics include best practices for organizing your themes and resources, using different fonts and typography styles, and shape theming… A lot of shape theming. We also revealed all of our favorite Material components! Lastly we looked to the future with new components coming out in MDC and Jetpack Compose, Android’s next generation UI toolkit which has Material Design built in by default.

Sample apps

During the series we used two different sample applications to demonstrate MDC :

  • “Build a Material Theme” (a.k.a MaterialThemeBuilder) is an interactive project that lets you create your own Material theme by customizing values for color, typography, and shape
  • Reply is one of the Material studies; an email app that uses Material Design components and Material Theming to create an on-brand communication experience

These can both found alongside another Material study sample app — Owl — in the MDC examples GitHub repository.

https://github.com/material-components/material-components-android-examples

MAD Skills Navigation Wrap-Up

Posted by Chet Haase

MAD Skills navigation illustration of mobile and desktop with Android logo

It’s a Wrap!

We’ve just finished the first series in the MAD Skills series of videos and articles on Modern Android Development. This time, the topic was Navigation component, the API and tool that helps you create and edit navigation paths through your application.

The great thing about videos and articles is that, unlike performance art, they tend to stick around for later enjoyment. So if you haven’t had a chance to see these yet, check out the links below to see what we covered. Except for the Q&A episode at the end, each episode has essentially identical content in the video and article version, so use whichever format you prefer for content consumption.

Episode 1: Overview

The first episode provides a quick, high-level overview of Navigation Component, including how to create a new application with navigation capability (using Android Studio’s handy application templates), details on the containment hierarchy of a navigation-enabled UI, and an explanation of some of the major APIs and pieces involved in making Navigation Component work.

Or in article form: https://medium.com/androiddevelopers/navigation-component-an-overview-4697a208c2b5

Episode 2: Dialog Destinations

Episode 2 explores how to use the API to navigate to dialog destinations. Most navigation takes place between different fragment destinations, which are swapped out inside of the NavHostFragment object in the UI. But it is also possible to navigate to external destinations, including dialogs, which exist outside of the NavHostFragment.

Or in article form: https://medium.com/androiddevelopers/navigation-component-dialog-destinations-bfeb8b022759

Episode 3: SafeArgs

This episode covers SafeArgs, the facility provided by Navigation component for easily passing data between destinations.

Or in article form: https://medium.com/androiddevelopers/navigating-with-safeargs-bf26c17b1269

Episode 4: Deep Links

This episode is on Deep Links, the facility provided by Navigation component for helping the user get to deeper parts of your application from UI outside the application.

Or in article form: https://medium.com/androiddevelopers/navigating-with-deep-links-910a4a6588c

Episode 5: Live Q&A

Finally, to wrap up the series (as we plan to do for future series), I hosted a Q&A session with Ian Lake. Ian fielded questions from you on Twitter and YouTube, and we discussed everything from feature requests like multiple backstacks (spoiler: it’s in the works!) to Navigation support for Jetpack Compose (spoiler: the first version of this was just released!) to other questions people had about navigation, fragments, Up-vs-Back, saving state, and other topics. It was pretty fun — more like a podcast with cameras than a Q&A.

(There is no article for this one; enjoy the video above)

Sample App: DonutTracker

The application used for most of the episodes above is DonutTracker, an app that you can use for tracking important data about donuts you enjoy (or don’t). Or you can just use it for checking out the implementation details of these Navigation features; your choice.