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 feel the atmosphere and, perhaps, encourage you to watch several reports posted on
the Google Developers channel .
Badoo Developers on Google I / O 2019Day 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 the 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 that makes 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 went in six-ten streams, and often we were divided to cover more interesting topics.
Day 1
The first day of the conference opens 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 togetherMain 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 USA);
- Google Assistant will work offline and will noticeably decrease in size, and audio messages in messengers and calls can be seen 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 work
somehow 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 flexing and stretching a device:
- the application should restore the same state;
- scroll position must be maintained;
- 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 ModeIt 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 are somehow affected by changes in the current branch;
- You can isolate testing of various functions of the application; for example, we have a gallery application in Badoo, in which all UI elements are collected, during their development this application can be assembled rather quickly, since it has a limited number of dependencies (my colleagues told about this in the MBLT DEV report );
- 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 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, as 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 linked logically.
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, this is not yet available.
We have more than 170 modules in the Badoo application, we are not using the dynamic feature yet, but we get other advantages
and disadvantages of multi-modularity.
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 title 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 the 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, and not in the device, as users do not pay attention to the device when they are passionate about AR.
- Avoid moments 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 its dangers. For example, it is worth warning the user about approaching pedestrian crossings and asking to lower the device.
- In an AR scene, objects must interact with real light, that is, the shadows should change as the lighting changes. ARCore provides lighting data in order to highlight virtual objects.
- Objects in AR must 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 in order to maintain the possibility of conveniently controlling it.
- The developer needs to clearly explain to the user that for an AR application to work, access to the device's camera is required.
More information on how to design AR elements in the app can be found in the
video from the conference .
Best practices for using text in the development of Android applications
This report describes the best practices for working with text and some changes in the new version of Android.
- Android Q will disable hyphenation.
- PrecomputedTextCompat helps to calculate the size of the text 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 the text (from highest priority to lowest priority):
- In Android, it will be possible to set folbacks 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 memorization of 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 training services.
And one more small news. In the report
GIFs and More: Integrating Expression Search in Your App, Google presented its API for working with GIF -
Tenor , an alternative to the well-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 application “lit up” in the presentation of TenorConcert
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. A
small fragment of the performance is available on the Internet.
Before the concertDay 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. Basically, I talked with other participants that day, but I’ll tell you about a couple of reports that you should pay attention to.
There are areas for communication 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 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 run again;
- continuous (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:
- at the start of 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 property being animated);
- 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 smoothly change the direction of motion;
- use <animated-selector> to add animation to the drawable; To avoid the implementation of transitions between all possible states, you can enter an intermediate state (for example, the loading state) and go through it.
But it is better to see once than
hear a hundred times
to read, so here is a
video with the 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 prompts a warning at the start;
- ProGuard / R8 must be turned on to measure performance correctly;
- the device must have a sufficient battery charge level so that a low charge level does not affect the measurement results;
- the module in which the performance tests are written should be with the parameter “debuggable = false”;
- You should not compare the results of measurements on different devices, they can vary greatly.
Conclusion
Badoo team and Google developerGoogle 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.
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.