What did Google I / O 2019 talk about: Android 10, AR apps and more

What did Google I / O 2019 talk about: Android 10, AR apps and more


In this article I will tell you 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 to feel the atmosphere and may encourage you to watch several reports posted on the Google Developers Channel .


Badoo Developers on Google I/O 2019

Day 0. Preface


To get to the conference, you need to win the lottery, which starts in February on Google I/O (usually it becomes known from news). But the victory does not provide for obtaining a ticket, but only gives the opportunity to buy it for $ 1,150. There are other programs that allow you to get a ticket with a big discount or for free, for example Code Jam . Students and employees of universities can buy a ticket much cheaper - for $ 375.

Before the conference, IT companies organized parties for the participants. I learned about them from the chat in Telegram, which brought together more than 150 Russian-speaking users. Typically, these chat rooms can be accessed by invitation from the specialized Android-communities in the Telegram. Such parties are a good opportunity to meet other conference participants in an informal setting. For example, we met there the organizer Mobius and the development team who make the app for air travelers App in the Air.

The conference was held under the slogan "No parking". Google organized free buses from and to the most popular hotels in the area, and also provided promotional codes for Lyft (an American competitor to Uber) taxi service.

There were five developers from Badoo. Everyone who won the opportunity to buy a ticket went. Reports were going from 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 the keynote man-DJ and AI-DJ work together

Breaking News


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

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

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.

The presentation for developers announced that Kotlin is now the main programming language for Android development. Google introduced the new library for the Camera X camera, a new declarative UI Jetpack Compose (apparently, it is still quite raw, 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.


During each report, subtitles are generated in real time

Google Tips for Folding Devices


Recently only lazy people are not talking about folding devices. Although they now occupy a scanty market share, applications should somehow work for them.

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

A few things worth checking out if you are implementing support for folding devices in your application, while bending and unbending the device:

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

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



Compatibility Mode

It seems that now there are very few users with folding devices, but the cost of such gadgets is quite high and you definitely need 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 multi-modularity:

  • tests can be run only for those modules that were somehow affected by changes in the current thread;
  • You can isolate testing of various functions of the application; For example, we have a gallery application in Badoo that contains all UI elements, and when developing them, you can build this application quickly enough, since it has a limited number of dependencies (more about this, my colleagues told in the report on MBLT DEV );
  • the ability to add dynamic features: according to the speaker, 80% of users use 20% of application functions, so most of the functions can be added to the dynamic module and loaded later; good candidates are, for example, features for expert users, features to pay for, the About Application screen; however, Onboarding should not be made a dynamic function, since it will be shown to all users of the application.

Multi-modularity also scales well for a large number of developers, which is a significant advantage for large and fast-growing teams.
Multi-modularity 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 logically linked.

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

We have more than 170 modules in the Badoo application, we don’t use the dynamic feature yet, but we get other advantages and disadvantages of multimodularity.

Day 2


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


Such an audience is completely filled with people in about ten minutes

New Declarative UI


The Android system is already ten years old, the current UI is obsolete. Old UI is quite difficult to maintain. For example, the View class has 29,188 lines of code, including comments, the AppCompat version has acquired a lot of hacks for different versions of Android. Looking at this picture, the developers of Google decided to make a UI-framework, which will be supplied with the application and will be completely untied from Android. The working name of the framework is Jetpack Compose.

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

View hierarchy is represented as functions annotated with @Composable annotation. The framework uses the Compiler Plugin to intercept calls to composable functions.
The Google team promises support for the new framework in the old hierarchies of View (using the @GenerateView annotations), as well as a preview right in Android Studio and support for animations.
Jetpack Compose is still quite raw and not ready for use in real applications, but it’s worth exploring how it works now to understand where Android development is heading.

Designing Augmented Reality Applications


Google has prepared tips for designing AR applications.

  • All interface elements should be on the AR scene, not in the device, as users do not pay attention to the device when they are passionate about AR.
  • Avoid times when the user needs to move back, as this can lead to injuries.
  • If an AR experience is built in a city, do not forget about its dangers. For example, you should warn the user about approaching pedestrian crossings and ask to lower the device.
  • In the AR scene, objects should interact with real light, that is, the shadows should change when the lighting changes. ARCore provides lighting data in order to highlight virtual objects.
  • Objects in AR should have the properties that they possess in reality. For example, the ball should bounce off the floor.
  • When the user moves the object far away, you need to increase the area of ​​contact of the object so that you can conveniently manage it.
  • The developer needs to clearly explain to the user that access to the device’s camera is required for an AR application to work.

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

Best practices for using text when developing Android applications


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

  • The default hyphenation will be disabled on Android Q.
  • PrecomputedTextCompat helps you calculate text sizes before rendering. It should be noted that it will be impossible to change the font and other TextView parameters after passing the parameters to the PrecomputedTextCompat.
  • Styles that apply to text (from highest priority to lowest priority):
  • In Android, you can set up foldbacks for fonts using Typeface.CustomFallbackBuilder. For example, if some application font 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 is translated into more than 40 languages, so it is 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 user from remembering the entered words (for example, when entering a promotional code).
  • If you need to use two languages ​​in the application, you can use setImeHintLocales to signal the keyboard that you need another language. This can be useful for dictionary applications or educational services.

And one more small news. The report GIFs and More: Integrating Expression Search in Your App Google presented its API for working with GIF - Tenor , an alternative to the long-known Giphy. We were one of the first to use it in our Badoo application, so we got on the slide to the speaker - as an example of use. Trifle, but nice!


Our app “lit up” in the Tenor presentation

Concert


At the end of the second day, Google organized a concert at which The Flaming Lips performed. To be honest, before I had not heard about it, but, apparently, in the US it is quite popular. There is an short excerpt available .


Before the concert

Day 3


The third day was short. Already by 4:30 pm all the reports were submitted, and with the end of the reports the conference ended as well. Basically, I talked with other participants that day, but I’ll tell you about a couple of reports you should pay attention to.


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

Animation Principles


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

Good animations must meet three criteria:

  • reentrant: the animation can be canceled and started again;
  • continuity (continuous): the animation should not jump from one state to another;
  • smooth (smooth): the 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); for 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 presses 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 according to 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 the command moves to point C, then if you use Spring Animation, the object will change direction smoothly;
  • Use & lt; animated-selector & gt; to add animation to Drawable; to avoid implementing transitions between all possible states, you can enter an intermediate state (for example, the loading state) and go through it.

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

Performance Testing


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

What is worth remembering when writing and running performance tests using Jetpack Benchmark Library :

  • on the emulator it is unreliable to collect measurements, kindly prompted by a warning at startup;
  • ProGuard/R8 must be turned on to measure performance correctly;
  • The device must have a sufficient battery level so that a low level of charge does not affect the measurement results;
  • the module in which the performance tests are written should be with the parameter “debuggable = false”;
  • You shouldn’t compare measurement results on different devices, they can be very different.


Conclusion



Badoo Team and Google Developer

Google I/O is 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 guys from VKontakte invented to make a dark theme and roll it out to users who asked: “Where is the dark theme?”, How on the other end of the Earth Tinder developers are struggling with spam and porn content and how the App in the Air team implemented autoregistration on air travel. You can also catch Google representatives creating the tools we use and ask questions of interest.

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

Source text: What did Google I / O 2019 talk about: Android 10, AR apps and more