What was said on Google I / O 2019: Android 10, AR-applications and much more

    In this article I will tell about my impressions of the Google I / O 2019 conference, which my colleagues and I visited the other day (and even “lit up” with our application in one of the presentations). It will help you get a feel for the atmosphere, and perhaps encourage you to watch a few reports posted on   the Google Developers channel .

    Badoo Developers on Google I / O 2019

    Day 0. Foreword

    To get to the conference, you need to win the lottery, which starts in February on the Google I / O website (usually this becomes known from the news). But victory does not provide for a ticket, but only makes it possible to redeem it for 1,150 dollars. There are other programs that allow you to get a ticket at a great discount or for free, for example, Code Jam . Students and university employees can buy a ticket much cheaper - for $ 375.

    Before the conference, IT companies had parties for the participants. I found out about them from a chat on Telegram, which brought together more than 150 Russian-speaking users. Typically, you can get into these chats by invitation from specialized Android communities in Telegram. Such parties are a good opportunity to meet other conference participants in an informal setting. For example, we met the organizer Mobius and a team of developers who make the app for the air travelers App in the Air.

    The conference was held under the slogan “No parking”. Google organized free shuttle buses to and from the most popular hotels in the area, and also allocated promotional codes for Lyft taxi service (Uber's U.S. competitor).

    There were five developers from Badoo. Let's go everyone who won the opportunity to buy a ticket. The reports went in six to ten streams, and often we split up to cover more interesting topics.

    Day 1

    The first day of the conference is opened by the so-called keynotes - general presentations. The first is for everyone, the second is for developers.

    Before keynote, man-DJ and AI-DJ work together

    Main news

    At the first keynote, presentations talked about different Google projects. Here are some news:

    • the company continues to develop Google Duplex - a robot assistant who can call and book time at the hairdresser / restaurant table;
    • Google Lens can analyze checks and share the invoice amount with the tip amount (a popular task in the USA);
    • Google Assistant will work offline and significantly decrease in size, and audio messages in instant messengers and calls can be seen as text on the screen using Live Relay.

    In Android 10 will appear:

    • more parental control;
    • dark theme;
    • improved support for folding devices;
    • new navigation gestures;
    • improved sharing;
    • New grouping of notifications by priority.

    At a presentation to developers, they announced that Kotlin is now the main programming language for Android development. Google introduced a new library for the Camera X camera, the new declarative UI Jetpack Compose (apparently, it is still quite crude, but very promising), new features for updating the application: the developer will be able to request the update on his own in the application interface.

    Subtitles are generated in real time during each report.

    Google folding tips

    Recently, only lazy people do not talk about folding devices. Although they now occupy a meager market share, applications on them should somehow work.

    Google representatives assured that if you follow the best practices, for example, correctly handle the screen flip, then everything will work out of the box. To support folding devices, the same mechanism is used as for multi-windows on tablets and Chrome OS. In addition to the already existing android: maxAspectRatio, android: minAspectRatio will appear to add restrictions on the aspect ratios of the supported parties in the application. Google claims that 2 inches (5.08 cm) will be the minimum screen width of Android devices starting with Android Q.

    A few things to check if you are implementing support for folding devices in your application when bending and unrolling the device:

    • the application should restore the same state;
    • the scroll position should be maintained;
    • keyboard focus should remain the same.

    If you do not want the Activity to resize, then the android: resizeableActivity = false flag may not always help, because the system can still resize the Activity or put it in compatibility mode:

    Compatibility mode

    It seems that users with folding devices now very little, but the cost of such gadgets is quite high and it is definitely necessary to check how the application works on them.

    On the pros and cons of multi-modularity

    At the conference, much attention was paid to modularity. The main advantages of multimodularity:

    • tests can be run only for those modules that are somehow affected by changes in the current branch;
    • You can isolate testing of various functions of the application; for example, in Badoo, we have a gallery application that contains all the UI elements; during their development, you can build this application quickly enough, since it has a limited number of dependencies (my colleagues spoke about this in a report on MBLT DEV );
    • the ability to add dynamic features: according to the speaker, 80% of users use 20% of the application’s functions, so most of the functions can be moved to the dynamic module and downloaded later; good candidates are, for example, features for expert users, features that you have to pay for, the About app screen; At the same time, Onboarding should not be made a dynamic function, since it will be shown to all users of the application.

    Also, multi-modularity scales well for a large number of developers, which is a significant advantage for large and fast-growing teams.
    Multimodularity also has problems. For example, it is not clear how to create a database. There are three approaches:

    • create one database for the entire application;
    • create a database for each module;
    • create one database for several modules that can be connected logically.

    All approaches have their drawbacks, but the guys from Google promise a bright future with Room, where they want to maintain module isolation and support cross-module queries, as well as modules with dynamic functions. Unfortunately, this is not yet available.

    We have more than 170 modules in the Badoo application, we do not use the dynamic feature yet, but we get other advantages and disadvantages of multi-module.

    Day 2

    The second day of the conference was the most eventful. The first report began at 8:30, and the last ended at 20:00. A total of 90 reports were submitted.

    This audience is completely filled with people in about ten minutes.

    New declarative UI

    Android is already ten years old, the current UI is morally obsolete. The old UI is hard to maintain. For example, the View class has 29,188 lines of code, including comments, the AppCompat version has overgrown with many hacks for different versions of Android. After looking at this picture, Google developers decided to create a UI framework that will come with the application and will become completely untethered from Android. The working name of the framework is Jetpack Compose.

    Flutter, React, Litho and Vue.js served as inspiration for developers, so the new framework will seem familiar to many. The main idea is to ensure that the UI responds to changes in the model, while there is no logic in the UI.

    The View hierarchy is represented as functions marked with the @Composable annotation. The framework uses the Compiler Plugin to intercept calls to composable functions.
    The Google team promises to support the new framework in the old View hierarchies (using @GenerateView annotations), as well as preview directly in Android Studio and support for animations.
    Jetpack Compose is still quite raw and not ready for use in real-world applications, but it’s worth studying the principles of its work now to understand where Android development is going.

    Designing Augmented Reality Applications

    Google has prepared tips for designing AR applications.

    • All interface elements should be on the AR scene, and not on the device, since users do not pay attention to the device when they are passionate about AR.
    • Avoid moments when the user needs to step back, as this may result in personal injury.
    • If the AR experience is built in the city, do not forget about its dangers. For example, you should warn the user about approaching pedestrian crossings and ask to lower the device.
    • On the AR scene, objects must interact with real light, that is, the shadows must change when the light changes. ARCore provides lighting data to make it possible to highlight virtual objects.
    • Objects in AR must possess the properties that they possess in reality. For example, the ball should bounce off the floor.
    • When the user moves the object far, it is necessary to increase the touch zone of the object so that it remains possible to conveniently control it.
    • The developer needs to clearly explain to the user that the AR application requires access to the device’s camera in order to work.

    More information on how to design AR elements in the application can be found in the video from the conference .

    Best practices for using text when developing Android applications

    This report talks about best practices for working with text and some changes in the new version of Android.

    • Android Q will disable hyphenation by default.
    • PrecomputedTextCompat helps you calculate the size of the text before rendering. It should be noted that changing the font and other parameters of the TextView after passing parameters to PrecomputedTextCompat will be impossible.
    • Styles that apply to the text (from highest priority to lowest priority):
      • Span
      • View (for example, defined by attributes in XML),
      • Style
      • Default style
      • Theme
      • Text Appearance.

    • On Android, it will be possible to set fallbacks for fonts using Typeface.CustomFallbackBuilder. For example, if some font of the application is not supported in one of the languages, then you can specify another as an alternative, you can also set fonts for emoji. Our application has been translated into more than 40 languages, so it’s important for us to understand how it will look if the main font is not supported in one of them.
    • Use android: imeOptions = "flagNoPersonalizedLearning" in EditText to prevent the memorization of entered words (for example, when entering a promotional code).
    • If you need to use two languages ​​in an application, you can use setImeHintLocales to signal the keyboard that you need a different language. This can be useful for dictionary applications or training services.

    And one more little news. In the presentation of GIFs and More: Integrating Expression Search in Your App, Google presented their API for working with GIFs - Tenor , an alternative to the long-known Giphy. We were one of the first to use it in our Badoo application, so we got to the speaker’s slide as an example of use. A trifle, but nice!

    Our application “lit up” in the presentation of Tenor


    At the end of the second day, Google hosted a concert at which The Flaming Lips performed. To be honest, I hadn’t heard of her before, but, apparently, she is quite popular in the USA. A small fragment of the speech is available on the Internet .

    Before the concert

    Day 3

    The third day was short. By 16:30 all the reports were submitted, and with the end of the reports the conference ended. Mostly on this day I talked with other participants, but I will tell you about a couple of reports that are worth paying attention to.

    There are communication areas at the conference where it is not recommended to use equipment

    Principles of Animation

    In his report, Nik Butcher talked about how to implement animations in the era of reactivity to improve the user experience. The problem is that in a reactive application, View objects have no state, and animations, on the contrary, have state.

    Good animations must meet three criteria:

    • restartability (reentrant): animation can be canceled and started again;
    • continuity: animation should not jump from one state to another;
    • smoothness: animation should change the speed / direction of movement gradually.

    How to achieve this:
    • when starting the animation, set only the final value (where it should end); at a given initial value, the animation can jump from one state to another, this can happen if it starts by pressing a button and the user clicks on it several times;
    • cancel the old animation before starting a new one (sometimes it is already implemented inside the Android SDK; for example, ViewPropertyAnimator, obtained from View # animate, cancels the previous animation for the animated property);
    • use Spring Animation ; such animations move taking into account the laws of physics, which means that smoothness and continuity are achieved more easily, that is, if an object moves from point A to point B and a command arrives to move to point C, then in the case of using Spring Animation, the object will smoothly change the direction of movement;
    • use To add animation to Drawable To avoid transitions between all possible states, you can enter an intermediate state (for example, a boot state) and go through it.

    But it’s better to see once than hear a hundred times to read, so here is a video with a report.

    Performance testing

    The library for measuring application performance is now in alpha state as part of Jetpack. It allows you to take measurements of code performance and avoids a lot of measurement errors, there is also integration with Android Studio.

    Things to remember when writing and running performance tests using the Jetpack Benchmark Library :

    • it is unreliable to collect measurements on the emulator, a warning at startup will kindly tell you about this;
    • ProGuard / R8 must be turned on in order to measure performance correctly;
    • the device must have a sufficient level of battery charge so that a low level of charge does not affect the measurement results;
    • the module in which the performance tests are written must be with the parameter "debuggable = false";
    • do not compare the measurement results on different devices, they can vary greatly.


    The Badoo team and Google developer Google

    I / O are definitely worth a visit. In such an atmosphere, over a cup of tea you can hear many interesting stories and learn about interesting engineering solutions. For example, about how the guys from VKontakte came up with a dark theme and rolled it up to users who asked: “Where is the dark theme?”, How on the other side of the Earth developers from Tinder fight spam and porn content and how did the App in the Air team implement auto registration for air travel. You can also catch Google representatives creating the tools we use and ask questions.

    In general, a conference of this level is not only a bunch of reports, but also many interesting people with whom you can exchange experiences.

    Also popular now: