📜 ⬆️ ⬇️

Hot on the heels of DroidCon Moscow 2015



From September 25 to September 27, DroidCon, the largest Eurasian conference for Android developers, was held in Moscow. Guests and speakers gathered at the Mail.ru office, which occupies one of the 27-storey towers of the business center. The conference itself lasted for three days, and the program of performances of each day was designed for different target audiences.




')

Tech day


The first and most interesting day. In order to register, it was necessary to pass a simple test that cut off people who are not directly related to Android-development. Two halls were opened - a cinema and a meeting room, in which reports were read in parallel.

Bussines day


On the second day, anyone could get to the conference, which led to an influx of a huge number of people, but the Mail.ru office could accommodate them all. Three halls were opened - the Atrium, the Cinema and the meeting room. Also on this day, opened an exhibition of various new products, one way or another related to Android. The exhibition lasted two days.

Sony showed TVs with the usual Android and told how to develop for them using conventional smartphones and special Android images created for the company's products. With the usual PS4 joystick, you could play Asphalt and win the new Sony Xperia Z5. To do this, it was necessary to pass the course for the best time during the day. Then they took the best players and held a match between them. ES Explorer looks very strange on a 40-inch screen :)

Epson showed off her augmented reality glasses. Of the minuses can be noted the following:


Intel introduced a new hardware for watches, phones and tablets, which were made based on the Intel Atom x3 processor. We spent hours drawing with all the fashionable things, like sleep trackers, pulse sensors, etc.

3D.RU : their site had little to do with Android. They demonstrated the capabilities of 3D printing and talked about technologies that are now actively used in this area.





Voximplant talked about their development. Key product features:


Community day




Visitors were the least. Three halls were opened - the Atrium, the Cinema and the meeting room. Workshops, democamps and barcamps were held on this day.

Workshops : these are reports that involve the active participation of the hall. The speaker tells how to introduce a new technology and what needs to be done for this, students at this time try to introduce it into the project, and if something does not work, then the speaker helps to solve the problem.

DemoCamp : various startups were given two minutes to present their project. Further, the jury spoke and gave their advice on how to improve the project.

BarCamp : on the second day of the conference, participants were asked to write topics of interest on the wall in the meeting room with a marker. And the next day, holivars were arranged if there were both opponents and supporters of this topic.

During the conference, we attended the following reports:

Secrets of success on Google Play


Alexey Kokin began his report with general statistics about Google Play. The report was divided into three parts:

The release of Android M is ready!


Denis Neklyudov told how to make existing applications compatible with Android M. The speaker also reported on the main innovations in Android M that will affect developers. Major changes:




Google App Indexing


Timur Akhmetgareyev told about one more way of application interaction. Google App Indexing itself offers several interaction options:


This Build should do 3 things: build, check and deploy.


Kirill Kharkiv spoke about his experience in using Gradle-build applications.

First, he set up a team with Git:


Next, Cyril told about the build-script on the example of their project. The assembly collects three different applications (each has its own package, resources, etc.), which can be simultaneously installed on one device. It is implemented through flavors. There are also 8 different buildType (usually two):

  1. Debug
  2. Release
  3. Alpha
  4. Branch
  5. Beta
  6. Corp beta
  7. Unit test
  8. UI Test

After running the full build, 24 different apk-files are obtained. They differ in application settings, resources, tests, disconnection, or those or other features.

For example:


Resource utilization is also quite an interesting idea. The problem is that some resources can be used in Appendix A, some in B, and some of the resources can be used in several applications at once. The following folder structure is proposed:


But there is a problem here. Since resources for application A will be formed from res + res_a + res_ab, resource identifier conflicts are possible, this should be closely monitored.

In addition, Cyril made recommendations on the use of static analyzers. The point is to write the rules for the same lint-a as far as code review. In the future, it will help to spend less time on code analysis and will guarantee compliance with the overall code style throughout the application.

Also, the speaker briefed on the new Test Support Library. According to the author, now you can use all the convenient solutions without having to select one specific framework. An example is push testing.

The final build phase is deployment. In the example given during the presentation, the build itself is deployed at different sites: Google Play, Hockey App, social networks, forums, corporate sites, etc.



Dagger2: practical educational program for working with daggers


The author of the report is Dmitry Polishchuk, developer of the Yandex.Taxi Android client. The presentation was devoted to the basics of Dependency Injection, used to reduce code connectivity. An example was considered with the Network Client, this class is often used throughout the application. Usually, when developing, we either create a new instance every time, or use singletone. We also encounter problems when we need to have different variations of the Network Client in the same application. For example, when our backend is not ready and we need to use mock'i.

Or to test the correct response of our code to certain responses from the API. As the author said, with this approach we have a snowball of strongly connected code, monolithic application code and obviously and not explicitly related code.

Problems using singletone:


To use this technology you need:


The main advantages of Degger2 over other libraries for Dependency Injection:


Data Binding and Custom Views


In this lecture, we expected to hear about a novelty from Google - Data Binding, which allows you to fill the screen with regular Pojo-objects by specifying directly in XML which fields and where should be recorded. The technology also allows you to create handlers for actions and even execute small pieces of code written in XML.

The author turned out to be an opponent of this technology, arguing it this way:


Instead, the author talked about his understanding of the MVVM pattern (Model-view-view Model). Using observers and custom views, you can implement the logic for filling types with data. The views are obtained completely self-sufficient, due to which we have a very unloading activity or fragment. It significantly reduces the amount of code.

Android SDK. Is the game worth the candle


In the autumn of this year, the release of Android Studio with NDK support finally took place. Part of the lecture was devoted just to this topic.

The report was divided into questions:

  1. Why use NDK.
    • Parts of the application where performance is critical. Work with audio, video, pattern recognition and game writing. Since in Java and Android there is such a thing as heap size, the processing of the same video becomes a very big problem. It is solved with the help of NDK.
    • Use already written libraries. Again, an example of video processing: there is a very popular ffmpeg library, most Android developers think about it when it comes to video integration.
    • One code on multiple platforms. Quite an interesting approach, but requiring knowledge of the C / C ++ programmer. This offers many advantages: only one test is needed, the code will behave the same on all planned platforms. Before the release of the new Android Studio, this feature was hard to implement, because the process of integration, debugging, and working with native code as a whole was very laborious, which negated all the advantages of this approach.
  2. The mechanism of work.
    • JDK is a set of tools for running native Java code.
    • NDK is a toolkit for using JNI in Android.
    • In the APK put so-files compiled under a specific platform.
    • The application can be fully implemented on the native code, but it is very rarely advisable.
  3. Experimental Gradle plugin. Its features:
    • NDK integration.
    • Debugging native code.
    • Refactoring (renaming in native code and in Java).

    Not yet supported:

    • Integration with external build systems.
    • Build static libraries.
    • Pure NDK modules.
  4. Performance.
    • Google itself recommends using NDK only when you can't do without it. There is such a thing as Overhead. The time to call a native method is much longer than calling a Java method from Java code. It is necessary to minimize the number of calls to native methods.
    • It is possible to use different compilers. For example, code compiled by the Intel compiler will show better performance on an x86 processor.
  5. Where to look for problems and how to deal with them.
    • Be sure to free the memory allocated in the native code, and be sure to reset the listeners passed to the native methods.
    • It is important to understand the difference between local and global links. The lifetime of local references is until the method ends. Global lifetime - until they are clearly not released.
    • The number of local links is limited, they also need to be released if they are no longer used.
    • By default, the garbage collector does not touch the native code. If it has a global reference to a Java object, then it will not be cleared until someone explicitly does. That is, we get two faces of memory from Java and from the NDK.
    • Get less from native code in Java and back.

    Native threads also have their own specifics:

    • Local links are never cleared by themselves.
    • The method for searching JNI classes does not work. Solution: cache classes or class loader during initialization.
    • Crashes in native code. They usually bring a lot of problems, since we will most likely have a short-informative log, or it may not exist at all. To solve this problem several libraries have been written:
      • Coffecatch - problem integration into the application.
      • Breakpad - inconvenient integration, because very little documentation.
      • Breakpad wrappers such as Crashlitics, Hockey App, etc.
    • APK size and use Apk Splits to solve the problem of large apk-files. By default, when building an application, the APK contains libraries for all platforms. Accordingly, the application significantly increases in size. This problem can be solved with the help of Gradle, by describing splits with indication of a different versionCode for each platform.




Nearby: new interaction opportunities near


The possibility of interaction between the two devices appeared in Android 4.0. This technology was called Wi-Fi P2P, the interaction was carried out via Wi-Fi. Then came Network Service Security. It used Multicast DNS and DNS-SD. The technology allowed to avoid interaction at a low level, but there were problems with the need to maintain a permanent connection.

Nearby is a library in Google Play Services that solves the problem of interaction in rather interesting ways. The library itself consists of two parts:

  1. Nearby Connections API. It appeared in early 2015 and allows devices to connect over a local network. For example, for co-editing files, for games over a local network, or for games on several screens, when one device is used for control, and the second for displaying the game itself.

    There are two types of devices - hosts and clients. On one device, we create a server, while others connect as clients.

    After establishing a connection using the Connection API, you can send messages. They are of two types:

    • Messages with guaranteed delivery. Their transfer takes more time, so it is advisable to use them only when it is impossible to prevent data loss.
    • Messages without guaranteed delivery. They are good to use when streaming audio / video.

    Advantages of this technology:

    • The ability to provide a good UX.
    • No internet connection required.
    • Low latency.
    • A large number of supported devices.
    • Easy integration.
    • Support reliable and unreliable messages.
    • The ability to simultaneously be a server and a client.
    • Ability to connect multiple clients.

    Disadvantages:

    • Devices must be on the same local network.
    • It is necessary to take into account that the devices can be far enough (the main thing is to be in the same local network).
    • Ability to intercept data in unprotected networks.
  2. Nearby Messages API. The technology appeared in September 2015. This is another way to solve the problem of transferring information between devices by sending broadcast messages over a short distance.

    The main disadvantage of technology: the data does not go from device to device, but through the Google cloud service. First, there is a request to the cloud to receive the token, then with its help the data is sent to the cloud, and then a broadcast request is sent to other devices 3-5 meters from the sending device. The token is transmitted via Bluetooth, Wi-Fi or ultrasound. At the last, the author drew attention. Ultrasound token transfer is a key feature of this library. Sound is not heard for people and most devices support this technology. Data is sent cyclically with a period of 3 seconds and a pause of 1 second between cycles.

    Recommendations for use:

    • Do not transmit anything secret, even in encrypted form.
    • Give the user a clear understanding of what he is sending.
    • Add an explicit button on / off Nearby.
    • Please note that the use of this technology greatly reduces the battery charge.
    • Use the new permissions system.

    The main disadvantage of technology is the small size of the message - three kilobytes.

Clean Architecture and MVP


Using the logical breakdown of the code into peculiar layers, the congestion of activity and fragments is reduced. It also solves the problem of reusing the code due to strong dependency. The pattern itself implies a breakdown of the entire application into three modules, which are weakly interconnected:

  1. Model - here is stored the logic of receiving data.
  2. View - implements the logic of displaying data.
  3. Presenter - this module manages all the processes associated with receiving, processing and displaying data. A good practice is to embed them in view through Dependency Injection.

Advantages of using this pattern:


The author during the report stressed that the MVP pattern is understood by everyone in different ways.

#Beyond Install. User Acquisition & App re-engagement @Twitter


This report discussed the feasibility and impact of adding social networks to your application in general, and Twitter in particular. Suppose we have a game in which we can reach a certain level. If you give the user the opportunity to publish his achievement on Twitter, then his followers will see a tweet like "I scored 500 points in the # such and such game." You can also add a picture so that subscribers are more likely to pay attention to this tweet.

After they saw him, there is some chance that the game will interest them. This way you can receive more and more new users who will be coming because of the tweets of satisfied players. It also gives us some free features.

The report also talked about Twitter’s paid features as a platform for customizing its application. The problem is that the user is likely to find out about your application from another user's tweet, and not from an advertisement. And, accordingly, it is more likely to install it. Therefore, thanks to the well-thought-out system of rewards and UX, you can get a pretty good promotion of your application without much effort.

Facebook for Android: Developing mobile applications for slow and congested networks


The author of the report did not go deep into the subtleties of implementation, rather stressed that their client works well in slow networks. For this, they:


Much attention was paid to testing applications. Of the key features, I remembered that they sent developers and testers to different countries, where they had to communicate with users on the topic of UX to make the application better.

During these trips, it was found out how the target audience of a country is using the application, and on the basis of these data the application has been refined.

It was told about an interesting approach to fixing bugs and crashes. Facebook collected statistics on all Android devices (of which there are more than 20,000) and concluded that, in development, it is often not necessary to have all devices. They divided all devices into 4 main groups according to the year of production and filling of the device.

And the phone, released in 2015, could easily get into the group of 2013 due to the fact that for the first time a device with similar characteristics appeared in 2013. From all this, it was concluded: each developer only needs to issue 4 devices on which and for which he can develop. It is assumed that if the application works normally on the phone released in 2013, then it should work on all devices from this group too.

Using the low-level multimedia API in Android


The developer of the official mobile client VKontakte talked about what problems there are now when using the current API, and how to solve them:


There are such problems when playing both audio and video.

The problem of caching could be solved by raising the local proxy server, but then there remains the problem of different implementations of MediaPlayer.

Recently, Google introduced ExoPlayer - a framework for working with media files. For audio, it has three levels:

  1. MediaExtractor - deals with networking, buffering and sharing.
  2. MediaCodec - unpacking media.
  3. AudioTrack - inference.

VKontakte implemented its MediaExtractor, which also allows you to cache data. Customization allows you to:


Previously, the video was very bad, especially if you had to play files with unsupported codecs out of the box. Has the situation improved with the release of ExoPlayer? again, due to the possibility of customizing the MediaExctractor. VKontakte can now reduce the video size by changing the resolution. This can be useful, for example, when downloading videos, for which quality does not play a significant role.

Learn to accelerate - hardware acceleration in Android





Israeli developer Royi Benyossef talked about hardware acceleration in Android.

What it gives us:


Hardware acceleration for drawing and calculations uses a GPU, which is much faster than a bunch of CPU and RAM. Due to this, we get better performance than using software acceleration.

Hardware acceleration for the first time became available for developers from version 11 of the API. Starting with version 14, it is enabled by default for all components.

When developing it is necessary:


The report concluded with the following:


What should be the application to qualify for a feature on Google Play


Here it was told about the experience of feature for the Chaos Control application. In Google Play in all categories there are all kinds of tops, recommendations, thematic collections. A developer may have a Top Developer icon.

How do apps get into all of these ratings? Everything is very simple. To get there, you must:


The feature itself has several steps:

  1. Nomination of an application to be featured by someone from Google who works with the developer community.
  2. Passage application Quality Review.
  3. Changes to the application and its metadata on Google Play based on the results of the Quality Review.
  4. Repeat review and feature if all comments are eliminated.

In reality, this happens like this: somehow, a Google employee finds out about your application, say, heard at some of the conferences, or found it on Google Play. He then nominates him for a feature within Google. Reviewers are gathered and evaluate your application by the following criteria:


After evaluating the application by the reviewers, an e-mail will be sent to you, indicating all the points that must be eliminated in order to qualify for a feature.

After correcting all comments, you must write a response to the letter. Then there is a re-evaluation, and so on until all the comments are corrected. After this, Google starts putting your app in various tops.

But do not hope that you will write a great application, observing all the best practices, and guaranteed to get a feature. The application must grow and develop without hope of it. Fichering can only be perceived as an additional promotion, and not as the main one, since even comments and user ratings can play a role when nominating for fichering.

Honey-Money (6.0): Android as an ideal ecosystem for corporate mobile applications


Corporate applications are those that are written to reduce or optimize costs in a company. Such an application does not have to be shared.

Suppose we have a gas station repair company. There are masters who repair them, and there are operators who accept applications for repairs. Using a simple application, you can:


Thanks to all this, you can save on:


When writing such an application, you must strictly observe the following rules:


For example, an application for the same master should be understandable and, if possible, be able to control using voice, gestures, eye movements, etc.

Conclusion


In conclusion, I would like to note the usefulness of such events. Thanks to the conference, we have been enriched with knowledge of how the development process in other companies is organized, what technologies they use, what rakes have come, what progress they have achieved. We also learned how certain development teams organize their work. Such information helps in future projects, because it is better to learn from the mistakes of others. Due to the variety of materials and the skill of the speakers, the conference motivated to learn, which is also important.

Source: https://habr.com/ru/post/269435/


All Articles