📜 ⬆️ ⬇️

Android N Preview: API and Developer Tools

Hi, Habr! Today we have something special in the program. New software versions are important for users: they provide access to new features on their devices. But even more important is getting timely access to new software for developers. Use the latest tools, API, check the application for compatibility, one of the first to introduce the latest and coolest developments ... In general, we are pleased to present you a test version of Android N for developers!



What else is important for the release of the test version for developers? By the fact that it is the developers who understand how important competent and timely feedback is. One good bug report could save you a lot of time, so we decided to release a developer preview much earlier than we did in previous versions.

The current version of Android N is preliminary, and not all the planned features are implemented in the available assemblies, however, a number of major features are available for testing now.
')
Multiwindows . Starting with Android N (and applications developed for it), you will have access to a new manifest attribute - android: resizableActivity. If the attribute is true, you can start your activity in split-screen mode on smartphones and tablets .

The behavior of the application in this mode is configured: for example, you can set the minimum size of the activity window so that users cannot make it smaller. The application's work in the multi-window mode is similar to the change in the orientation of the display from landscape to portrait: changes in the appearance of the application will occur automatically. The alternative is to allow the system to suspend the activity and restart it with new dimensions.

For devices with a large diagonal (for example, for set-top boxes and smart TVs), the activity can be switched to picture-in-picture mode. This function is great for applications that play videos. To use it 100%, do not forget to set the android attribute: supportsPictureInPicture to true.




Instant Response Alerts . The RemoteInput alert API, which was originally added to work with Android Wear, now works in version N for smartphones and tablets. Using this API, users can quickly and easily respond to incoming messages without interrupting the current application or closing the notification panel. Read more about it here .

United Alerts . The appearance of the notification panel has changed in each version of Android, in 5.0 and 5.1, we have achieved excellent functionality and visibility, in 6.0 improved usability. In the N version, we added what we were asked about: the ability to group and deploy the same type of alerts from each of the applications. To do this, we introduce the Notification.Builder.setGroup () method. With the alert property enabled (for example, private messages on social networks), they will be grouped into one object in the notification panel. The user will be able to unfold them: to do this, simply “pinch” his fingers with a pinch (a gesture similar to the multitouch approximation) or double-tap the corresponding “mega-notification”. Read more about this feature here .

Save battery power . In Android Marshmallow, we implemented an improved “sleep” mode for a device called Doze, which reduced battery consumption during those moments when you are not using the device. New APIs were supposed to prepare applications to support this sleep mode, since in version N, the Doze function works every time the screen goes blank.

If you have already adapted your application for Doze — for example, using the GCM service for important alerts — then everything is fine. For those who have not yet been involved in adapting to Doze, an article about starting work with this technology is useful.

In addition, we continue to develop Project Svelte, making the Android N background work more efficient . As a result, the operating system should take up less memory and become available on more devices. If you use JobScheduler for background tasks, then you are on the right track. If not, then the new version of N will be an excellent reason to switch to this technology, especially since it has expanded its functionality. Already, you can use the JobScheduler control to quickly respond to changes in the content provider.


Improved support for Java 8 . Android keeps up with the times: Java 8 is now available to developers! With the Android Jack compiler, you can use a variety of popular Java 8 functions, including lambda expressions. They are available on Android devices, starting with the Gingerbread version. Using new features, you reduce the template code. For example, lambda expressions can replace anonymous inner classes when instances of event listeners are provided. Some features of Java 8 — for example, the static method and the default method, stream, functional interfaces — are also available in N and later versions. Using the Jack compiler, we hope to better track Java usage while ensuring backward compatibility with background tasks.

Beginning of work


The preliminary developer version N includes an updated SDK with system images. All this can be used to test the work on the official Android emulator, as well as on devices Nexus 6, Nexus 5x, Nexus 6P, General Mobile 4G (Android One), Nexus Player, Nexus 9 and Pixel C. And to quickly implement these features on tablets , we will give developers a discount of $ 150 on Pixel C devices .

This test version is intended only for developers, and not for a wide audience. We plan to frequently update the system images of the N preview during the development of the test program. Closer to the final release, our team will invite users for testing.

We are well aware that not many people have the desire, besides adapting their application, to engage in moreover with the firmware of the test device. To facilitate the lives of developers and testers, we created an Android Beta program. Starting today, you can upgrade your Android device to the pre-N version for developers and get regular updates “over the air.” You will find all the necessary instructions on g.co/androidbeta .

Click here to learn more about getting started with the Android N developer preview. Write us about your impressions! The sooner we get feedback from you, the more your wishes we can take into account. Well, of course, according to the good old tradition, you can try to guess the name of the new version of Android. Good luck. ;)

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


All Articles