Skip to main content

What is new in Android O (API level 26) Developer SDK



With each new version of Android, a corresponding version of Android SDK is also realised for App developers. New version of Android comes up with some new features, new hardware /software support and some new APIs are also written by Google developers. Therefore, new SDK release is named after the API level of the Android Framework it is written for.
Version
Code name
Launch Devices
Each new version of Android SDK essentially aimed to achieve some or all of the following:
> Bug Fixes / Facilitate Improvement over last version API.
> Facilitate APIs for new features
> Facilitate better / optimized overload or separate classes for existing APIs
> Mark as depricated or remove obsolete APIs
    Android SDK is a bundle of APIs usually written in Java (and / or Native code) to facilitate interaction between User (application layer) and OS / underline Android framework of the device. 

With Android O SDK, there are number of new features and APIs that developers can take advantage of in their apps.
Here I will try to talk about few top updates of Android O (API level 26).

1. Picture-in-Picture (PIP) Mode

credit: android developer guide

One of the most exiting updates in Android 8.0 is picture-in-picture (PIP) mode. PIP is a special type of multi-window mode mostly used for video playback. It lets the user watch a video in a small window pinned to a corner fo the screen while they can navigate and work on some other apps at the same time. PI leverages the multi-window APIs available in Android 7.0.

PIP mode is partially available in Youtube app, which let user browse other videos while current video is pinned in a small window at bottom right corner.

2. Multi-display Vs Multi-window

Android 8.0 (API level 26) supports enhanced support for multiple displays. If an Activity supports Multi-window mode, user can move the activity from one display another. If your activity supports Multi-window mode, Android 8.0 automatically enables multi-display support for that activity.
ActivityOptions class provides two new methods to support multiple displays.


  • setLaunchDisplayId to specify which display the activity should be shown on when it is launched.
  • And getLaungDisplayId, return activity’s current display id.   

  • adb shell is also updated to support multiple displays:
    adb shell start <activity_name> --display <display_id>
    

    3. Notifications

    credit: android developer guide
    Number of updates have been done with Notifications since Android M (API level 23) and it is continued with Android 8.0 (API level 26) as well. Notifications have been redesigned to provide an easier and more consistent way to manage its behaviour and settings. Below are some notable ones:
    • Android 8.0 SDK introduces Notification Channels which let you create customizable channels for each type of notification you want to display to the user and user can change the behaviour of a channel (by long pressing) or even block notifications coming from a particular channel.
    • Android 8.0 APIs introduces support for Notification Badges on app launcher icon.
    • User can Snooze a notification to remove and appear at later time
    • Notification timeout can be used to let the notification go away automatically after a specified time. See setTimeoutAfter()

    4. Autofill Framework

    Android 8.0 API level 26 makes filling forms easier with autofill framework. This allows users to avoid entering the same information in forms every time once user has enabled Auto Fill Service from Settings. Auto fill data is managed by AutofillManager class which manages the data repository to store form field data.

    5. Downloadable Fonts

    Android 8.0 API Level 26 and Android Support Library 26 provides APIs to access from a provider application or download it from remote instead of bundling files into APK. This feature has multiple benefits including: reduced APK size, increased installation rates and improves overall system health as multiple APKs can share the same font through font provider. A font provider is an application which retrieves fonts and caches them locally so other apps can request and share fonts. Learn more about Downloadable Fonts.

    6. Fonts as XML

    Android 8.0 lets you use Fonts as resources, this means there is no need to bundle fonts as assets anymore. You can simply put all your fonts under a new folder res/font and access in code like R.font.typo_graphica.
    You can also define a custom font family using simple XML like this:

     <?xml version="1.0" encoding="utf-8"?>
    <font-family xmlns:android="http://schemas.android.com/apk/res/android">
        <font    android:fontStyle="normal"    android:fontWeight="400"    android:font="@font/lobster_regular" />
        <font    android:fontStyle="italic"    android:fontWeight="400"    android:font="@font/lobster_italic" />
    </font-family>
    
    
    Learn more about Fonts as XML.

    7. Autosizing TextView, Adaptive Icons

    Android 8.0 APIs lets to set the size of your text to expand or contract automatically based on the size of the TextView for device screen. That will allow easier optimization of text size while developing for different screens or with dynamic content.  See Autosizing TextViews
    Android 8.0 introduces adaptive launcher icons. Adaptive Icons support visual effects and can display variety of shapes across different device models. Lear more about Adaptive Icons

    8. WebView Improvements

    Android 8.0 provides number of updates to WebView, including Google Safe Browsing API to enhance security of web browsing. Other new updates are:
    • Version API
    • Termination Handle API
    • Renderer Importance API
    • For more information on how to use these APIs, see managing webviews.  

    9. Margins and Padding Simplified

    Android 8.0 (API level 26) provides unified margin and padding attributes such that you can use only one attribute to define margin or padding from both ends (left, right or top, bottom). It is particularly useful when you want the same margin/padding from opposite sides:

    10. Input and Navigation

    Android SDK 8.0 includes some notable updates/improvements in this category:
    • Keyboard Navigation Clusters: Now you can manage complex layouts having multiple input controls, by organising them in groups/clusters. Users can use Meta + Tab or Search + Tab in Chromebook devices to navigate from one cluster to another. To make a View or ViewGroup a cluster use:
    android:keyboardNavigationCluster=true in your layout XML or use
    View.setKeyboardNavigationCluster(true) in your apps UI logic. 
    • View Default focus: In Android 8.0 (API level 26), you can assign a view to receive focus by default when activity is recreated or user presses a keyboard navigation key (e.g. Tab) Apply this in your Layout, set a view element’s android:focusedByDefault=true in Layout XML or call View. setFocusedByDefault(true) in app’s UI logic. 

    11. ContentProvider Improvements

    Android SDK 8.0 comes up with tow notable improvements for ContentProvider: Content Provider paging and Content refresh requests.
    ContentProvider now supports paging of data while loading large datasets to load one page at a time. Each page of results returned by the content provider is represented by a single cursor object. Both client and provider must implement paging to use this feature, see ContentProvider and ContentProviderClient.
    ContentProvider and ContentResolver both provide a new method refresh() method to let content provider know whether the information they have is up-to-date. Client app can explicitly request refreshed content using ContentResolver.refresh(DATA URI).

    12. JobScheduler Improvements

    There are number of improvements to JobSchedular, which include:
    • JobScheduler now supports work queue similar to. To add a work item to a Job’s queue, call JobScheduler.enqueue() method. This functionality handles most of use cases which were previously handled by IntentService.
    • Android Support Library 26.0.0 introduces a new class JobIntentService which provides the same functionality as IntentService but uses jobs instead of services when running on Android 8.0 or higher.
    • Scheduled jobs new supports new constrains: 
    JobInfo.isRequireStorageNotLow(); // job does not run if the device storage is lowJobInfo.isRequireBatteryNotLow(); // job does not run if device battery level is at or below ‘Low Battery’ threshold

    13. Media Enhancements

    In Android SDK 8.0, there are several enhancements and improvements for android media APIs (android.media).
    mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_2_TS);
    • The MediaMuxer can now handle any number of audio and video streams (in SDK 7 it was limited to only one audio and video tracks each)

    14. Wi-Fi Aware

    Android SDK 8.0 support Wi-Fi Aware which is based on Neighbour Awareness Networking (NAN) specification. On Device with Wi-Fi aware hardware, apps and nearby device can discover each other and communicate without an Internet access point. Read more at official documentation page to make your next app WiFi aware.

    15. Bluetooth

    Android 8.0 (API Level 26) comes with following new features for Bluetooth:
    • Support for AVRCP 1.4 standard which enables song library browsing
    • Support for BLE 5.0 standard
    • Integration of Sony LDAC codec into Bluetooth stack
    • You can now customize the pairing request dialog for Bluetooth, BLE, WIFI, see Companion device pairing

    16. Smart Sharing

    Android 8.0 (API level 26) learns about user’s personalised sharing preferences and suggest right apps to share with. Smart sharing can be used with Image, audio, video, text URL etc. All you have to do is to add an arraylist with up to three annotations into your share Intent.
       ArrayList<String> annotations = new ArrayList<>();
            annotations.add("topic1");  //e.g. ‘family party’. to list only social apps        annotations.add("topic2");
            annotations.add("topic3");
            intent.putStringArrayListExtra(
                    Intent.EXTRA_CONTENT_ANNOTATIONS,
                    annotations
            );
    //startActivity(Intent.createChooser(intent,”share this”));
    To learn more about Smart sharing annotations, see EXTRA_CONTENT_ANNOTATIONS.

    17. Android Enterprise

    Below are some highlights of new Enterprise feature added in Android 8.0:
    • Work profile to let enterprise separate work from personal data and manage both
    • UX improvements
    • New Controls over Bluetooth, WiFi, backup and security let enterprise manage more.
    • Read here for more details on Android for Enterprise.
    Credits:


    Comments

    Post a Comment