Posted by Manuel Vicente Vivo, Developer Relations Engineer, @manuelvicnt
As Android apps grow in size, it's important to design the code with an architecture in place to allow the app to scale, improve quality and robustness, and make it easier to test.
An app architecture defines the boundaries between parts of the app and the responsibilities each part should have. This favors the separation of concerns principle that enables the aforementioned benefits.
In response to community demand for up-to-date guidance on app architecture, we're launching a revamped guide to app architecture. This includes best practices and recommended architecture for building robust, high-quality apps. It also provides a page for each layer of the recommended architecture: UI, domain, and data layers. Within them, you'll find deep dives into more complex topics, such as how to handle UI events.
Each Android app should have at least two layers:
You can add an additional layer called the domain layer to simplify and reuse the interactions between the UI and data layers.
General diagram of a typical app architecture. The UI layer gets the application data from the optional domain layer, or the data layer, that exposes application data.
We have created a learning pathway to help you consume this content in order and in a trackable way. Don't miss the chance to learn all of this and get a badge as recognition!
If you’re a beginner, you should begin by understanding the benefits of having an app architecture and then follow these recommendations as a first approach to the topic. Intermediate and advanced developers can follow these recommendations and customize them to their needs. In fact, our research suggests that most professional developers are already using these best practices.
You might be wondering if you should update your existing architecture to follow this recommendation, and the answer is no… or wait… it's up to you. If your current architecture works for your team, you might want to stick with it. But you might also find patterns in our guides you can benefit from and incorporate into your app.
This is the first batch of documents we're releasing, with more to come in 2022. Help us make the guidance better! If you have any feedback on the current recommendations or if you want to see other architecture-related topics in them, let us know in our docs issue tracker.
Posted by Purnima Kochikar, Vice President, Google Play Partnerships
Hello there,
Today we are kicking off Notes from Google Play, a new series where several times a year we celebrate your creativity and impact, and share key insights and best practices, to inspire you to be bolder, go further, and build even more innovative apps and games.
Purnima Kochikar addresses our goals behind the 'Notes from Google Play' series.
2021 continued to be a year of challenges and uncertainty, and you inspired us by your ability to turn obstacles into useful and joyful apps and services. Your apps helped over 2.5 billion people using Android devices learn, connect, relax, exercise, laugh, have fun, and so much more. As a result, developers making over 1M USD per month with Google Play’s billing or having 10 million monthly active users grew by 30% this year.
In this inaugural edition of Notes from Google Play we celebrate your creativity and resilience. A developer who exemplified these traits and deeply moved and inspired me and my team is Mohammed Kamara. Thank you, Mo for channeling deep personal loss to create a better world for women of color, providing affordable and customized healthcare through the app. We are humbled to play a small part in making your vision for InovCares a reality.
Mohamed Kamara, CEO and Founder of InovCares, tells the story behind his groundbreaking healthcare app.
A special shout out also goes to the winners of the Best of Google Play Awards and the Indie Games Festival. All of you inspire us to continue to work hard to evolve Play and Android to enable you to build great apps and successful businesses.
This focus on you and your success resulted in many impactful developments in 2021, including the evolution of our business model and new product features and tools. At Google Play we are focused on two key goals - helping you build and grow sustainable global businesses and investing in Android and Play platform features, tools, and ecosystems to enable you to build innovative apps and games.
As the mobile industry has matured, you have created app businesses that have varying needs, so we’ve designed multiple programs to support you. For example, we created the Play Media Experience Program to encourage Video, Audio, and Books developers to build great cross-device experiences, while enabling apps that support authors & musicians by discounting the service fee as low as 10%. A few months ago we announced a new fee structure to support the evolution of the subscriptions business model, allowing all subscription app developers to benefit from lower fees. Due to the innovative changes we announced this year, I’m thrilled to share that 99% of developers globally now qualify for a service fee of 15% or less. Thank you for your thoughtful feedback while we were designing these programs and your vocal support since the launch of the new fee structure.
We have also continued to invest in programs to help you reach, retain, and re-engage your users.
We are committed to empowering you to turn your creative ideas into excellent apps and have created tools and guidelines to help ensure your apps are of high quality. I invite you to pay attention to three key features/guidelines:
Trust and safety are the cornerstones of sustainable business success and key to user loyalty. This year, we continued to invest in platform features and policies that help you build safer apps and strengthen user trust. We also heard your feedback and have invested in educational tools and resources to help you anticipate and understand the new features and policies. The key highlights this year -
Nothing excites me more than finding and nurturing the next generation of talented developers and building local ecosystems around the world that address local needs. Earlier this year we announced a reduced service fee tier of 15% on the first $1M in annual earnings for all developers, helping us continue to foster innovation on Android/Play.
It has been truly humbling to see key influencers, stakeholders, and industry and government leaders co-invest with us in this effort. Our most successful developers invested personal time and energy to mentor, coach, and grow Indies through the Indie Games Accelerator. Government leaders partnered with us to support startup ecosystems in countries like Korea and India - the ChangGoo program in Korea has been created in partnership with Ministry of SMEs and Startups (MSS) and the Korea Institute of Startup & Entrepreneurship Development (KISED), whereas the Appscale Academy in India was established in partnership with the MeitY Startup Hub, an initiative of the Ministry of Electronics and Information Technology (MeitY). Thank you all for your commitment to innovation and the app ecosystem.
Get a snapshot view of Appscale Academy: our growth and development program for startups across India.
I have missed seeing you in person over the last two years. The challenges imposed by COVID-19 helped us find new ways to stay connected. Many of you participated in virtual sessions to learn about new market opportunities and engaged in thoughtful online discussions on topics as diverse as Future of Work, Diversity, Equity, and Inclusion, and Growth and Global expansion strategies. Some of you also told us that you are feeling some online event fatigue, so this year we also invested in content that you can consume at your own pace including thought leadership and best practices, and e-learning courses on Play Academy. We even launched our first certificate to help you get the most out of our store listing tools and features.
Until the next edition, from my team to yours, best wishes for the upcoming year. We hope you will always see Google Play as a partner to help you delight your users, expand your audience, and grow your business.
Happy Holidays.
Purnima Kochikar,
Vice President, Google Play Partnerships
Make sure you don’t miss future editions by following me / us on Twitter or signing up to our monthly newsletter.
Posted by Maru Ahues Bouza, Director, Android Developer Relations
Apps are essential to making Android a platform people love - whether it’s on their phones, cars, TVs, or watches. As a popular mobile platform, Android is thriving with 1 in 4 developers - worldwide - building for Android according to Stack Overflow’s 2020 developer survey.
In Android Developer Relations (or Android DevRel for short), our mission is to help developers be successful on Android by helping them build great apps with the latest Android and Play features, empower anyone to get a great career as an Android developer, and advocate for developers as Android and Play evolve. It’s truly rewarding because we get to see the future of apps - every day - and help our fellow developers achieve great things. With such a big mission, we’re hiring engineers, technical writers, and program managers - and if this gets you inspired, we’d love to talk! Check out the links at the end of this blog and apply to join our team.
But first, what does Android DevRel actually do? Our team works with external developers, writes code, creates content, launches careers, grows communities, runs conferences - and more. Read on to learn more!
We work with product and engineering teams in Android and Play to define go-to-market strategies for new developer products and run Early Access Programs (EAPs) with the goal of building better products for all developers. Through these EAPs, we do deep technical engineering work with the most influential developers to help them integrate and deliver feedback to validate that the products we’re building are ready to work at scale.
We work with these developers to build high quality apps across multiple screens, to ensure better user experiences on Android and we share their success stories to show how integrating with these products will help developers be more successful in the Android ecosystem, and to help inspire other developers to adopt.
A big part of how we help developers is through code — be it tutorials, videos, blogs, or entire multi-unit educational courses. We produce everything from simple code snippets that explain how to perform a specific function, to sample apps like Jet* or the Google I/O app that demonstrates how everything comes together. In the process of creating sample code, you may be the first developer to ever build something with a new API! We call this being the “zeroth customer” and it’s an important role where you can directly influence the direction of a product through feedback (and yes, some trial and error!)
In helping developers, we end up learning best practices and producing a ton of content - documentation, tutorials, screencasts, talks, blog posts, podcasts, and more. There is an art to breaking down complex subjects into a learning path - to help both beginner and advanced developers alike - and it is something we do every day. From introducing new concepts, to distilling best practices, to thoroughly documenting the functionality of a new API - our role is to help developers understand and thrive on Android. While our output is the content itself, it’s important to note that engineering is at the heart of this. In order to teach developers how to use these technologies, we first have to understand them deeply ourselves.
Teach millions of developers through learning materials
Many of us were Android developers before we joined DevRel, and one of the most gratifying aspects of our role is meeting and connecting with developers around the world. We engage with Google Developer Experts for Android (GDEs), Google Developer Groups, and of course individual community members on a regular basis through events, social media, and Slack. We love to hear what people are working on, lend a hand where we can, and create connections across the community so people can learn from each other.
One of the places the community comes together is at conferences - and Android has a lot of them! While you can pick up a skill or learn about the latest software design pattern, people always say the most valuable thing they get from conferences is connecting with fellow developers. Meeting people in person (side note: can’t wait until we can do that again!) is such an important part of building a network of people you can count on for help - whether you get stuck in your next project, or are looking for career advice. While many of these conferences are run by the community themselves, we participate in these events around the world and look forward to engaging with this community wherever they are. We also organize the Android Developer Summit and the Android track at Google I/O.
Apps connect you to the people in your life, help you do things more easily, or even help you learn new skills. In the past year many of us have had to find new ways of doing things, and this has seen us reach for apps more often than ever before, while growing the demand for app developers. In fact, developer jobs are growing 5.5x faster than other professions (U.S. Bureau of Labor Statistics). In Android DevRel, it is our privilege to build curriculum and work with universities and student groups around the world to skill-up the next generation of developers.
Training the next generation of Android developers
Want to join Android DevRel? Take a look at some of the roles below. Google often uses a single listing to make it easier for people to apply - so if it doesn’t say Android DevRel in the title of the role just tell them you’re interested in joining our team in your cover letter.
Android DevRel works with developers everywhere in the world, we want our team to represent all the developers we work with and we believe that diverse teams build better products that work for everyone. If you’re from an underrepresented group in tech, please apply even if you don’t think you match all the requirements and read what we’re doing to build a more diverse and inclusive Google.
Read on to see the roles that are available today:
At Android Dev Summit in October we highlighted the growth we’re seeing in large screen devices like tablets, foldables, and Chromebooks. We talked about how we’re making it easier to build great app experiences for these devices through new Jetpack APIs, tools, and guidance. We also introduced a developer preview of 12L, a feature drop for Android 12 that’s purpose-built for large screens.
With 12L, we’ve optimized and polished the system UI for large screens, made multitasking more powerful and intuitive, and improved compatibility support so apps look better right out of the box. 12L also includes a handful of new APIs for developers, such as for spatial audio and improved drag-and-drop for accessibility.
Today we’re releasing the first Beta of 12L for your testing and feedback as you get your apps ready for the feature drop coming early next year. You can try the new large screens features by setting up an Android emulator in Android Studio. 12L is for phones, too, and you can now enroll here to get 12L Beta 1 on supported Pixel devices. If you are still enrolled in the Android 12 Beta program, you’ll get the 12L update automatically. Through a partnership with Lenovo, you can also try 12L on the Lenovo Tab P12 Pro tablet, see the Lenovo site for details on available builds and support.
Today’s Beta 1 build includes improvements to functionality and user experience as well as the latest bug fixes, optimizations, and the December 2021 security patches. For developers, we’ve finalized the APIs early, so Beta 1 also includes the official 12L APIs (API level 32), updated build tools, and system images for testing. These give you everything you need to test your apps with the 12L features.
With 12L, we’ve focused on refining the UI on large screen devices, across notifications, quick settings, lockscreen, overview, home screen, and more. For example, on screens above 600dp, the notification shade, lockscreen, and other system surfaces use a new two-column layout to take advantage of the screen area.
Two-column layouts show more and are easier to use
Multitasking is also more powerful and intuitive - 12L includes a new taskbar on large screens that lets users instantly switch to favorite apps on the fly or drag-and-drop apps into split-screen mode. Remember, on Android 12 and later, users can launch any app into split screen mode, regardless whether the app is resizable. Make sure to test your apps in split screen mode!
Drag and drop apps into split-screen mode
Last, we’ve improved compatibility mode with visual and stability improvements to offer a better letterboxing experience for users and help apps look better by default. If your app is not yet optimized for large screens, make sure to test your app with the new letterboxing.
As you optimize your apps for large screens, here are some of our latest APIs and tools that can make it easier to build a great experience for users.
Make sure to check out all of our large screens developer resources for details on these and other APIs and tools.
With the 12L feature drop coming to devices early next year, now is a great time to optimize your apps for large screens. For developers, we highly recommend checking out how your apps work in split screen mode with windows of various sizes. If you haven’t optimized your app yet, see how it looks in different orientations and try the new compatibility mode changes if they apply.
The easiest way to get started with the large screen features is using the Android Emulator in a foldable or tablet configuration - see the complete setup instructions here.
Now you can also flash 12L onto a large screen device. Through a partnership with Lenovo, you can try 12L preview builds on the Lenovo Tab P12 Pro. Currently Lenovo is offering a Developer Preview 1 build, with updates coming in the weeks ahead. Visit Lenovo's 12L preview site for complete information on available builds and support.
12L is coming to phones, too, and although you won’t see the large screen features on smaller screens, we welcome you to try out the latest improvements in this feature drop. Just enroll your supported Pixel device here to get the latest 12L Beta update over-the-air. If you are still enrolled in the Android 12 Beta program, you’ll automatically receive the update 12L.
For details on 12L and the release timeline, visit the 12L developer site. You can report issues and requests here, and as always, we appreciate your feedback!
Posted by Alex Vanyo, Developer Relations Engineer
Watch faces are one of the most visible ways that people express themselves on their smartwatches, and they’re one of the best ways to display your brand to your users.
Watch Face Studio from Samsung is a great tool for creating watch faces without writing any code. For developers who want more fine-tuned control, we've recently launched the Jetpack Watch Face library written from the ground up in Kotlin.
The stable release of the Jetpack Watch Face library includes all functionality from the Wearable Support Library and many new features that make it easier to support customization on the smartwatch and on the system companion app on mobile, including:
If you are still using the Wearable Support Library, we strongly encourage migrating to the new Jetpack libraries to take advantage of the new APIs and upcoming features and bug fixes.
Below is an example of configuring a watch face from the phone with no code written on or for the phone.
Editing a watch face using the Galaxy Wearable mobile companion app
If you use the Jetpack Watch Face library to save your watch face configuration options, the values are synced with the mobile companion app. That is, all the cross-device communication is handled for you.
The mobile app will automatically present those options to the user in a simple, intuitive user interface where they change them to whatever works best for their style. It also includes previews that update in real time.
Let’s dive into the API with an overview of the most important components for creating a custom watch face!
A subclass of WatchFaceService forms the entry point of any Jetpack watch face. Implementing a WatchFaceService requires creating 3 objects: A UserStyleSchema, a ComplicationSlotsManager, and a WatchFace:
WatchFaceService
UserStyleSchema
ComplicationSlotsManager
WatchFace
Diagram showing the 3 main parts of a WatchFaceService
These 3 objects are specified by overriding 3 abstract methods from WatchFaceService:
class CustomWatchFaceService : WatchFaceService() { /** * The specification of settings the watch face supports. * This is similar to a database schema. */ override fun createUserStyleSchema(): UserStyleSchema = // ... /** * The complication slot configuration for the watchface. */ override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager = // ... /** * The watch face itself, which includes the renderer for drawing. */ override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = // ... }
Let’s take a more detailed look at each one of these in turn, and some of the other classes that the library creates on your behalf.
The UserStyleSchema defines the primary information source for a Jetpack watch face. The UserStyleSchema should contain a list of all customization settings available to the user, as well as information about what those options do and what the default option is. These settings can be boolean flags, lists, ranges, and more.
By providing this schema, the library will automatically keep track of changes to settings by the user, either through the mobile companion app on a connected phone or via changes made on the smartwatch in a custom editor activity.
override fun createUserStyleSchema(): UserStyleSchema = UserStyleSchema( listOf( // Allows user to change the color styles of the watch face UserStyleSetting.ListUserStyleSetting( UserStyleSetting.Id(COLOR_STYLE_SETTING), // ... ), // Allows user to toggle on/off the hour pips (dashes around the outer edge of the watch UserStyleSetting.BooleanUserStyleSetting( UserStyleSetting.Id(DRAW_HOUR_PIPS_STYLE_SETTING), // ... ), // Allows user to change the length of the minute hand UserStyleSetting.DoubleRangeUserStyleSetting( UserStyleSetting.Id(WATCH_HAND_LENGTH_STYLE_SETTING), // ... ) ) )
The current user style can be observed via the CurrentUserStyleRepository, which is created by the library based on the UserStyleSchema.
CurrentUserStyleRepository
It gives you a UserStyle which is just a Map with keys based on the settings defined in the schema:
UserStyle
Map
Map<UserStyleSetting, UserStyleSetting.Option>
As the user’s preferences change, a MutableStateFlow of UserStyle will emit the latest selected options for all of the settings defined in the UserStyleSchema.
MutableStateFlow
currentUserStyleRepository.userStyle.collect { newUserStyle -> // Update configuration based on user style }
Complications allow a watch face to display additional information from other apps on the watch, such as events, health data, or the day.
The ComplicationSlotsManager defines how many complications a watch face supports, and where they are positioned on the screen. To support changing the location or number of complications, the ComplicationSlotsManager also uses the CurrentUserStyleRepository.
override fun createComplicationSlotsManager( currentUserStyleRepository: CurrentUserStyleRepository ): ComplicationSlotsManager { val defaultCanvasComplicationFactory = CanvasComplicationFactory { watchState, listener -> // ... } val leftComplicationSlot = ComplicationSlot.createRoundRectComplicationSlotBuilder( id = 100, canvasComplicationFactory = defaultCanvasComplicationFactory, // ... ) .setDefaultDataSourceType(ComplicationType.SHORT_TEXT) .build() val rightComplicationSlot = ComplicationSlot.createRoundRectComplicationSlotBuilder( id = 101, canvasComplicationFactory = defaultCanvasComplicationFactory, // ... ) .setDefaultDataSourceType(ComplicationType.SHORT_TEXT) .build() return ComplicationSlotsManager( listOf(leftComplicationSlot, rightComplicationSlot), currentUserStyleRepository ) }
The WatchFace describes the type of watch face and how to draw it.
A WatchFace can be specified as digital or analog and can optionally have a tap listener for when the user taps on the watch face.
Most importantly, a WatchFace specifies a Renderer, which actually renders the watch face:
Renderer
override suspend fun createWatchFace( surfaceHolder: SurfaceHolder, watchState: WatchState, complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository ): WatchFace = WatchFace( watchFaceType = WatchFaceType.ANALOG, renderer = // ... )
The prettiest part of a watch face! Every watch face will create a custom subclass of a renderer that implements everything needed to actually draw the watch face to a canvas.
The renderer is in charge of combining the UserStyle (the map from CurrentUserStyleRepository), the complication information from ComplicationSlotsManager, the current time, and other state information to render the watch face.
CurrentUserStyleRepository)
class CustomCanvasRenderer( private val context: Context, surfaceHolder: SurfaceHolder, watchState: WatchState, private val complicationSlotsManager: ComplicationSlotsManager, currentUserStyleRepository: CurrentUserStyleRepository, canvasType: Int ) : Renderer.CanvasRenderer( surfaceHolder = surfaceHolder, currentUserStyleRepository = currentUserStyleRepository, watchState = watchState, canvasType = canvasType, interactiveDrawModeUpdateDelayMillis = 16L ) { override fun render(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) { // Draw into the canvas! } override fun renderHighlightLayer(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) { // Draw into the canvas! } }
In addition to the system WYSIWYG editor on the phone, we strongly encourage supporting configuration on the smartwatch to allow the user to customize their watch face without requiring a companion device.
To support this, a watch face can provide a configuration Activity and allow the user to change settings using an EditorSession returned from EditorSession.createOnWatchEditorSession. As the user makes changes, calling EditorSession.renderWatchFaceToBitmap provides a live preview of the watch face in the editor Activity.
Activity
EditorSession
EditorSession.createOnWatchEditorSession
EditorSession.renderWatchFaceToBitmap
To see how the whole puzzle fits together to tell the time, check out the watchface sample on GitHub. To learn more about developing for Wear OS, check out the developer website.
Posted by Florina Muntenescu, Developer Relations Engineer
From updates to Jetpack libraries, more guidance on using Kotlin coroutines and Flow in your android app and new versions of Android Studio, here are the top 3 things you should know:
We’ve been working to add the features you’ve been asking us for in a lot of Jetpack libraries, here are a few highlights:
But if you want to deep dive, you should really check out: WorkManager - back to the foreground - where you’ll learn all about the latest APIs and features.
Coroutines are the recommended solution for asynchronous work and Kotlin Flow is the obvious choice for managing streams of data in Android apps. To learn how to use Flows in practice, check out this Android Dev Summit session:
The talk also covers important things like how to stop collecting from the UI when it’s not needed, using the newly stable lifecycle-aware coroutines APIs: repeatOnLifecycle and flowWithLifecycle.
In the Android Studio world, Arctic Fox is stable, Bumblebee is in Beta and Chipmunk is in Canary, all of them bringing a bunch of new features for Jetpack Compose and Material You, developer productivity and 12L and large screens.
The What’s new in Android Studio talk is a must see, especially the sneak peek demo of LiveEdit. LiveEdit is a generalization of live editing of literals, where you get to edit more general scenarios than just constants and strings: you can comment out parts of the UI, reorder composable calls and see the result on the phone in milliseconds. But, we want to make sure that this feature is really right before we include it in Android Studio, so stay tuned for it in the next releases.
You want more? Then sit back, relax and watch the full Modern Android Development playlist.
Posted by Clara Bayarri, Engineering Manager
This year’s Android Dev Summit brought a lot of updates related to Large Screen development for Android, the 12L feature drop on foldables and tablets - a set of features optimising Android 12 for large screens, better developer tools and updates to Google Play purpose-built for large screens. Here are the top 3 things you should know:
12L makes Android 12 even better on Large Screen devices, with a bunch of new refined UI across surfaces such as notifications and the lock screen. The most important announcements for developers included
To find out more about what’s new, check out the What’s new for large screens and foldables video and developer.android.com/12L .
Android has supported Large Screens for a long time, but we announced several new tools to help you scale up your app’s UI to larger form factors.
Learn more about all these items in the Building Android UIs for Any Screen Size and Design beautiful apps on foldables and large screens talks, and check out the latest Large Screen guide and Build adaptive layouts in Compose guide for more. You can also check out Best practices for video apps on foldable devices and Spotify Across Screens for examples on how apps are making this journey.
To help users find the best apps on tablets, foldables and ChromeOS devices, we’ve got new changes in Play to recommend apps optimized for the large screen. This includes new checks to assess app quality, so we can feature large screen optimized apps and update search rankings to show the best possible apps for these devices. We will also be introducing large screen specific app ratings, so users will be able to rate how your app works on their large screen devices.
You can find all of this year’s Android Dev Summit talks related to Large Screens in this playlist, and the full list of announcements for Large Screens in our blog post.