What’s new in Android 7.0 for developers
OUR Blog
Android developer
Alexander Marchenko
Android developer
MOBILE
Dec 12 2016

What’s new in Android 7.0 for developers

The given article describes the main innovations for developers which were introduced with a new Android N operating system. Some of the features have had a positive effect on the platform, namely a multi-window mode, which can be easily integrated to your application, changes in notifications, battery saving and more.

Multi-window

For us, multi-window mode is the most long-awaited feature of Android N presented by Google. Users can view several apps while on one screen, be it tablet or smartphone.

Example of multi-window mode resource: developer.android.com

MW mode support can be easily turned on in your application - by adding attribute android:resizableActivity with value True for your Activity.

The behavior of your application in this mode can be configured, for instance, you can specify the minimum size of your application’s screen, so that the user cannot make it smaller. Work with orientation is similar to work with cornering and screens’ display in landscape and portrait modes, the system deals with processing automatically, or as a variant, you can restart Activity with new size after the system suspends it.

In addition, if we consider the work with large screens, such as smart TV, the activity may work in the so-called picture-in-picture mode, this feature is well suited for applications in which the video is played.

To enable this function, it is sufficient to set the attribute android:supportsPictureInPicture with the true value.

Set default values for our Activity in the following way:

<activity android:name=".MyActivity">
    <layout android:defaultHeight="500dp"
          android:defaultWidth="600dp"
          android:gravity="top|end"
          android:minHeight="450dp"
          android:minWidth="300dp" />
</activity>

You can read more about MW mode here.

Direct reply notifications

The ability to quickly respond to alerts has been added.

Quick access to notification functions

resource: developer.android.com

API RemoteInput has been added for convenient work in Android Wear is now available on tablets and smartphones. With this API, the user will be able to quickly respond to a message without looking up from the current screen, to respond, so to speak, directly in the notification. Details on API RemoteInput can be found here.

Sending message from notification

resource: developer.android.com

Bundled notifications

Let’s consider notifications again. It is now possible to group them.

Example of grouping notifications

resource: developer.android.com

As Google says,

“We have done what was asked of us - added the ability to group and expand notifications”.

For example, all messages from a social network will be grouped. If necessary, it can be deployed - users need two fingers to dissolve this group (the same touch as we use to zoom a photo).

Or double-tap the super notification to deploy all notifications in a group. To enable this developers will need to use Notification.Builder.setGroup() method, which was added to Android N. Read more about notifications grouping here.

Efficiency

Google has integrated into Marshmellow an enhanced sleep mode for the device, called Doze, which strongly influenced the battery savings in situations where the user does not use the device. The new API was to prepare a supplement for this regime, since in Android N Doze works every time you turn off the screen. If your application is adapted to Doze, for example you use GCM Push notifications which switch from sleep mode automatically - you do not need to adapt the application to Doze; otherwise, if you use AlarmManager for some tasks, you should read the article, which will help you get acquainted with this technology.

Improved Java 8 language support

Java 8 support is improved in Android N. Jack compiler allows to work closely with some popular functions, such as lambda expressions.

This will help you reduce template code, which increases class sizes significantly. For example, lambda expressions can replace anonymous inner classes provided by EVentListener, and also such popular functions of Java 8 as default method, static method, streams. In order to experience Java 8 in your Android project fully, all you need is to enable Jack compiler in your project by adding a couple of lines to build.gradle file.

android {
    ...
    defaultConfig {
        ...
        jackOptions {
            enabled true
        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Android is the most popular platform in the world and it is developing at lightning-fast paces. With each update Google makes Android more and more stable, safe and, of course, convenient both for users of “green robot” devices and for developers. Google did a great job on Android N, emphasizing performance, safety and efficiency. We are waiting for the next update and hope it to be no less interesting.

Useful links

1. What's new in iOS 10 for developers

2. Official page: Developer.android.com

3. How to choose the correct platform for mobile app development

SIMILAR POSTS
Dec 06 2016
The article contains a brief description of the latest functionality available after the release of iOS 10.
Nov 23 2016
All necessary features that you should know before developing your own music app. Statistics, estimated cost and our hands-on experience.
Nov 17 2016
Getting started with Kotlin and third-party libraries Glide, Dagger 2, Retrofit 2, Realm, MVP and RxJava on Android.