Writing in the front

The last blog post covered a lot of tidbits during the DEVELOPER Conference (although tidbits are an important part of the conference itself), but in this blog I will focus more on the session itself and minimize the off-site tidbits and tidbits. Without further ado, let’s begin.

Android things

Android Things is a new platform that supports computing needs around the world, and it emerged as a way to simplify the development and generation of IoT devices. Android Things still runs Android, so those familiar with Android development can get up and running pretty quickly.

At the event, speakers gave a detailed demonstration of how to develop programs on Android Things devices that were given away at the conference. He developed an application for thermometers and barometers using temperature sensors and pressure sensors. Development is divided into three steps:

  1. Assemble device Assemble instructions
  2. Burn component version Flash Android Things
  3. Develop Develop Apps with Android Studio 3.0+

The most important part of the example section is learning how to input and output peripherals, how to let the program know when a button is pressed, how to display sensor values, and how to integrate the drivers of the application peripherals INPUT and output library. Interested friends, recommend to codelab to learn. Codelab is also a highly recommended learning site by Google, with a dedicated booth in the exhibition area and a growing number of tutorials being translated into Chinese, which is a good thing.

PWA framework and tools

Progressive Web Applications (PWA), which was briefly introduced in the previous article, still had two sessions around it the next day. First, PWA tools. The speaker first introduced why tools are needed. The so-called tools are things that make it more convenient for users to complete a certain job and save users’ time.

One of the main features of PWA is that it saves bandwidth for users, lets browsers and web pages know about your application, and if it helps users make decisions on top of the default generation, it’s even better. In Chrome, you can see the network requests during and after installation in the developer Panel, which visualizes the network requests at runtime and provides some suggestions for users to formulate caching strategies.

When building PWA, he introduced Workbox, a JavaScript library, as a collection of tools for creating, testing, and experiencing Service workers. He goes on to show how PWA works with CLI of popular frameworks like Vue, React, Angular, and so on, and how to configure it based on JSON.

TensorFlow

TensorFlow is on fire. If Angular was the hero of GDD last year, TF is this year. The long queues and increased number of sessions at the venue are a reflection of Google’s shift from Mobile First to AI First. The session was still presented in Chinese by Anna Kim throughout the session, which was sometimes stuttering but persevered. The session was mainly advertising about TF’s popularity, TF’s success in the medical field (more than doctors with many years of experience) and AlphaGo’s victory over the world’s top Go players. TF supports more hardware platforms, including CPU, GPU, Cloud TPU and even Android, ios and Android Things. Finally, I briefly covered the TF architecture.

TensorFLow architecture diagramCopy the code

ARCore

AR, which is expected to steal the limelight with artificial intelligence, is also a highlight of this conference. ARCore session is jointly completed by two people in charge of technology and user experience.

First, the technician took the stage. He introduced the history of the development of immersive computing. Then he introduced the number of ARCore releases :100,000,000. The new features of ARCore, namely environment recognition and light estimation, are introduced.

Then the engineer in charge of user experience gave a speech. She introduced that in the exhibition area, users still used to Zoom in and Zoom out with two fingers, instead of trying to move the camera and the model for interaction. When the user Ge You lay on the sofa, he was lazy and would not move his body out of the comfort zone. She suggests giving users a clear prompt or a good reason to move within the program.

The stage was then handed back to the tech engineer, who announced the big news that Chrome will support ARKit and ARCore. I think this is a great benefit for AR, because many young people are not willing to buy the head display, and it is very likely that they will not carry it with them, not to mention the middle-aged and old people of their parents’ generation. If Chrome supports AR, it will lower the bar for using AR. Tutorial links

About ARCore framework itself, divided into four parts to introduce.

  1. Tracking state
  2. The plane
  3. Feature points
  4. Light gauge

Tracking state means that no matter how your camera moves, the model will also perform certain Angle and position changes to fool the human eye into thinking that the model is really more integrated into the scene. This process is also called offset correction. What needs to be mentioned here is the concept of an anchor point, which is the location specified when the object of AR adds the actual object.

Another concept is plane, this will take time to test, like ARKit, also take some feature points are used to determine a plane, we are all know that the three points can determine a plane, using multiple point here from the efficiency of calculation, fast determine the boundary of the plane and the plane. Of course, multiple planes of a plane can also be detected simultaneously.

The example of light detection impressed me a lot. It used a lion who seemed to be startled and jumped up when the light was turned off. The process of detecting light from bright to dark was perfectly explained. Video address.

Android Oreo

Android version 8.0 is the oreo (water), inevitably, also opened a few on the conference session, because I don’t Android developers, so at the time of selection at the venue, basically to avoid the topic, but for some people into not to go to hubei, and don’t want to waste time, also the assorted listened to some.

The first is the update of Android Studio, which can help users analyze and improve application performance. It also adopts a visual way to visualize network requests, CPU usage, memory management and other indicators that control the core of user experience in time series, so that users can easily see. At which time point the consumption of resources is more obvious, so as to enter the internal optimization of relevant functions. The scene cited a memory management error and correction example.

Angular uses components to create sessions for Android applications. For example:

  • Make your application more robust
  • Easy for test teams to test
  • Maintainability has improved a lot
  • Low coupling, suitable for team development, etc

Here she focuses on two features of Android components: observable and perceivable life cycles. The observable observer pattern has the benefit of being associated with the lifecycle and avoiding memory leaks. Taking the persistent data Room component as an example, it provides the following benefits:

  • Reduced boilerplate code
  • Query results are converted to JAVA objects
  • Verify SQL statements at compile time
  • The query result can be observed

Because I haven’t heard the whole story, and I don’t know much about Android development, I can only throw out a few links for interested readers:

GitHub example book

Google is helping programmers optimize their apps: automatic detection, visualization of resource usage, and even help users analyze users who are leaving the app to increase user engagement. Componentized development reduces the difficulty and speed of developing Android applications.

The future of the Internet

The title of this session is very broad, it’s a prediction of future trends, and it’s an interesting topic.

The new API

The speaker is a German. He thinks that the future Web application should be dominated by full-screen PWA. Now the display property can be set to “fullscreen” to cover up the time, Bluetooth and wifi information at the top of the phone, and create a sense of immersion with the current full-screen phone.

Second, he talked about how push notifications on the Web have become just like native apps, giving the example of a notification center in macOS. It follows the Setup rules of macOS do not disturb mode to better integrate with the platform.

Next comes one of the big advantages of PWA: Service worker navigation preloading, which allows the system to initiate the network request at the same time as the service worker starts while the user makes the GET navigation request. While this won’t avoid startup delays, it will eliminate the limitation of blocked network requests and allow users to get the content they want faster.

Next up is the one-click registration API, which creates an account using a Google email address. You can use the previously selected information to automatically log in to the callback user. The link

When estimating storage space, developers often face the question: Is there enough storage to support the next operation? The problem of choice has been solved. The API link

The Image Capture API allows you to Capture still images and configure your camera’s hardware Settings. The API link

Shape Detection API, used to detect faces, read bar codes and even perform optical character recognition (also known as OCR). The API link

Media Capabilities API, which allows Media to play smoothly and efficiently. Get more information about device decoding capabilities to help developers make the best decisions when choosing media streams for their users. For example, set 1080p or even 4K streaming for better phones and 480p streaming for 1000-yuan phones. The API link

NetInfo is designed to complete the above API Settings. The main thing is to check the network of the phone. If it supports retina display screen, but it is only 2G at present, it also chooses non-HD media streaming. The API link

WebVR, an open standard, brings virtual reality experiences to the browser. Refer to the link

Navigation Timing API, which obtains the overall performance of the device, such as the render time, page load time, page connection time, etc. It is also to give a judgment of different media streams for different users. The API link

JavaScript new USES

Dynamic module import, lazy loading of JavaScript code, dynamic loading of code when needed, improve user experience, improve application performance, similar to lazy loading in Swift.

Asynchronous generator function, simplify the consumption of streaming data transmission. Can be used for for-of loops and to create custom asynchronous iterators through asynchronous iterator factories.

The Finally method in promises ensures that the system does what it needs to do regardless of whether a Promise is ultimately accepted or rejected.

The data transfer

Web Bluetooth, which communicates with nearby Bluetooth devices, is currently only partially implemented in Chrome, and will have to wait. The API link

Web USB is an access control designed for network devices, HTTPS only, and must be enabled by the user. Again, it’s only partially implemented in Chrome so far, and we’ll have to wait. The API link

Build products for a billion people

The last session was about user experience, and the title was very big, building products for a billion people. The speaker is an Indian engineer who weighs a billion.

When the user scale reaches 1,000,000,000 people, it usually means that users come from all over the world, with completely different backgrounds and cultures, even with vastly different infrastructure from one country to another. The Internet speed in developed countries is 50 times faster than that in developing countries, and the proportion of users with an Internet speed of more than 4Mbps also varies greatly in Vietnam. Countries like Venezuela, it’s probably less than 1%; In terms of Internet access, 8% of Vietnamese income is spent on traffic. Probably most of the people in those countries are still in our GPRS era when 1M flow was 10 yuan more than ten years ago. In this case, the App needs to be tailored to the user’s device’s differences in mobile Internet speed and connection quality.

The speaker offered suggestions on optimizing application products from five aspects:

  1. The connection
  2. Equipment capability
  3. Traffic cost
  4. battery
  5. content

His advice for optimizing network connections is to prescribe a finite order of traffic, known as text precedence. The images haven’t finished loading, and with the text, the app at least seems to be working. Second, network requests should be de-duplicated. Network requests should not be repeated and frequent. The third point is to adjust the behavior according to the network connection performance, that is, the streaming media quality requested in the 2G network environment and wifi environment mentioned above should be different.

In terms of graphics, he recommends providing SVG when appropriate and webP images otherwise. SVG is a vector image that is undistorted at any small resolution and is small in size. Dynamic diagrams are generally large, so it is best to inform the user of the dynamic diagram size. Of course, he also mentioned PWA’s offline caching experience, so that users don’t feel like the app is unavailable when the connection is slow or disconnected (although it is).

When building an application, it also needs to be built specifically for small and medium screens, optimized for medium and low density screens, and tested with simulator configurations.

Memory is an important resource, and he encourages applications to adjust their footprint to the available RAM to avoid long-running processes. The Aforementioned Android Studio memory monitor can help developers do just that.

The size of an APK installation package is highly dependent on traffic, and images consume the most traffic. To compress APK files, he recommends using ProGuard to reduce the code size and making multiple APKs an option in build.gradle. Also, the use of data traffic can be seen in Android Studio. And users should be given the right to choose, such as NetEase Cloud Music, which allows users to download songs only when wifi is available.

In terms of battery consumption, avoid unnecessary awakenings, such as GPS, which is a power drain, so don’t use it in the background all the time. It is better to use batch processing for network requests to save energy. Firebase JobDispatcher is also highly recommended.

In terms of fast adaptive interfaces, he encourages touch feedback everywhere, and once a button is pressed, even if it takes a while, users are usually willing to wait for feedback to tell them that they actually pressed it. The second point is that the interface should always be in an interactive state, that is, in the android main thread, and no other transactions should be handled, as the UI might get stuck. The UI refresh rate always needs to be 60fps to feel smooth. The best thing to do with the interface, of course, is to follow Google’s Material Design.

In terms of localization, he said that most developers think about providing users with multilingual support, but one thing that is often overlooked is the choice of fonts, some of which are very unreadable in certain countries.

conclusion

Zhihu once had a question about what evils Baidu has done, and a mirror question about what evils Google has done. One well-liked answer: get out of mainland China. In the blink of an eye, it has been almost 8 years since search services left the mainland. Let’s hope Google search and other services come back as soon as AI does.

This year’s Google Developer Conference is over, each session is only 30 minutes, just a start, the following research and use depends on the audience developers, I hope the reference links in this article can help you!


If this article is helpful to you, please use Alipay or wechat to support me to continue to create, thank you.