Android P Features & API

Overview

Google released the latest version of Android that is Android P. This is not a full version. It’s just a preview version for developers. Google did not declare What the P stands for. So, in my article I will use the name of this released version as Android P.

Introduction

Android P introduces great new features and capabilities for users and developers. This article highlights what are the new features for the developers.

Let’s discuss what’s new in Android P. Here are some notable changes for developers as follows:

  • Indoor Positioning with Wi-Fi RTT
  • Display cutout support
  • Notifications
  • Multi-camera support and camera updates
  • ImageDecoder for bitmaps and drawables
  • Animation
  • HDR VP9 Video, HEIF image compression, and Media APIs
  • Data cost sensitivity in JobScheduler
  • Neural Networks API 1.1
  • Autofill framework
  • Security enhancements
  • Client-side encryption of Android backups

Indoor Positioning with Wi-Fi RTT

To leverage advantage of indoor positioning in your apps, Android P introduces platform support for the IEEE 802.11mc Wi-Fi protocol. This protocol is also known as Wi-Fi Round-Trip-Time (RTT).

Using this new RTT APIs, your app can measure the distance to nearby RTT-capable Wi-Fi Access Points.

For enabling this feature in your app, the device must be location enabled, and Wi-Fi scanning should be turned on (Setting -> Location). And for that we have to set the following permission:

By this, our app will be eligible to get indoor positioning data down to a meter or two meters. It works by measuring the distance to various Wi-Fi access points. Using this feature, you can develop new ideas like “in-building, navigation” and “fine- grained location-based services”.

Display cutout support

Android P offers support for Display cutout, it means edge to edge screens for camera & speaker. Android P introduces a new DisplayCutout class, which finds out the location and shape of defined areas where the app content shouldn’t be displayed.

To get that defined area’s existence, we can use the following method:

cutout

There is now an attribute which allows our application to set display cutout around the device screen, which is known as layoutInDisplayCutoutMode.
We can set the following values for this attribute:

  • LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
  • LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
  • LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER

Notifications

Android P introduces many improvements to Notifications as following:

notifcation

Enhanced messaging experience

Support for displays images

Identify people involved in conversation

Save replies as a draft:

Identify the type of conversation like Group or Single conversation

notifcation2

Set the semantic action for an intent
Ex. Mark as read, delete, reply.

Smart reply

Channel settings, broadcasts, and Do Not Disturb

Blocking channel groups

New broadcast intent types

– Using NotificationManager reference.

New Do Not Disturb priority categories

Multi-camera support and camera updates

Android P supports access to streams from one or more cameras simultaneously. Using this new feature, we can develop innovative features with dual-front or dual back cameras, that we can’t do with single camera like seamless zoom, bake and stereo vision. We can automatically switch between two or more cameras using a logical or fused camera.

muticamera

Android P also introduces many features related to camera as follows:

  • Flash support
  • Image stabilisation
  • Special effects
  • External USB/UVC cameras
  • Reduce delay during initial capture

ImageDecoder for bitmaps and drawables

Android P introduces modern concepts for image decoding. We can use ImageDecoder class to decode images.

Create a Drawable or a Bitmap from byte buffer, a file or a URI

Scale decoded image within the exact size

Crop image within the range of scale, image cell

Create a mutable Bitmap

Animation

Android P introduces a class for drawing & dimpling a GIF and WebP animated images which is AnimatedImageDrawable. It works similar to AnimatedVectorDrawable. Using AnimatedImageDrawable, app will animate image without interfering with your app UI thread.

HDR VP9 Video, HEIF image compression, and Media APIs

Android P supports High Dynamic Range (HDR) VP9 Profile 2. So now we can transfer HDR-enabled data to user from YouTube, Play Movies, and other data sources on HDR-capable devices.

HEIF image encoding is supported by Android P

  • Supports Image compression to save on storage and Network data.
  • Easy to utilize images from the server

MediaPlayer2 is also a new feature for Android P. This player supports to build playlist using DataSourceDesc.

Data cost sensitivity in JobScheduler

Android P provides features to handle network related jobs for the user.

When below methods help appropriately, JobScheduler handle the work properly.

When Job runs perfectly be sure to use the Network object returned by JobParameters.getNetwork()

Neural Networks API 1.1

Neural Network API introduced in Android 8.1 for device machine learning in Android. Android P enhances support for nine new ops:

  • Pad
  • BatchToSpaceND
  • SpaceToBatchND
  • Transpose
  • Strided Slice
  • Mean
  • Div
  • Sub
  • Squeeze

Security enhancements

Android P introduces many new security features:

  • Unified fingerprint authentication dialog
  • High-assurance, user confirmation of sensitive transactions

Client-side encryption of Android backups

Android P supports encryption of client side secret data in Android backup. Using this feature device are able to restore user’s PIN, Pattern or Password which is backed up by the user’s device.

mm

Payal Senjaliya Android Developer

I am an Android Developer at Yudiz Solutions Pvt. Ltd. - a leading mobile app development company. I like to work with real-time data communication with hardware connectivity, to maximize development efficiency and produce innovative applications.

Comments are closed.

Top