Android 9 highlights and APIs 

Android 9 (API level 28) presents extraordinary new highlights and capacities for clients and designers. This record features what's happening for designers. 

To find out about the new APIs, read the API diff report or visit the Android API reference. Additionally make certain to look at Android 9 Behavior Changes to find out about zones where stage changes may influence your applications. 

Indoor situating with Wi-Fi RTT 

Android 9 includes stage support for the IEEE 802.11mc Wi-Fi convention—otherwise called Wi-Fi Round-Trip-Time (RTT)— to let you exploit indoor situating in your applications. 

On gadgets running Android 9 with equipment support, your applications can utilize the RTT APIs to quantify the separation to close by RTT-fit Wi-Fi passages (APs). The gadget must have area administrations empowered and Wi-Fi examining turned on (under Settings > Location), and your application must have the ACCESS_FINE_LOCATION authorization. The gadget doesn't have to associate with the passageways to utilize RTT. To look after protection, just the telephone can decide the separation to the passage; the passageways don't have this data. 

On the off chance that your gadget quantifies the separation to at least 3 passageways, you can utilize a multilateration calculation to evaluate the gadget position that best fits those estimations. The outcome is ordinarily exact inside 1 to 2 meters. 

With this exactness, you can manufacture new encounters, as in-building route and fine-grained area based administrations, for example, disambiguated voice control (for instance, "Turn on this light") and area based data, (for example, "Are there exceptional proposals for this product?"). 
See the WiFi RTT API being used in the Android Wifi Rtt Scan demo application. 

Android 9 offers support for the most recent edge-to-edge screens that contain show patterns for cameras and speakers. The Display Cutout class lets you discover the area and state of the non-practical zones where substance shouldn't be shown. To decide the presence and situation of these pattern territories, utilize the getDisplay Cutout technique. 

Another window format property, layout In Display Cutout  Mode, permits your application to spread out its substance around a gadget's patterns. You can set this ascribe to one of the accompanying qualities: 

You can recreate a screen pattern on any gadget or emulator running Android 9 as follows: 

Empower engineer alternatives. 

In the Developer choices screen, look down to the Drawing segment and select Simulate a presentation with a pattern. 

Select the size of the pattern. 

Note: We suggest that you test the substance show around the pattern zone by utilizing a gadget or emulator running Android 9. 


Android 9 acquaints a few upgrades with notices, which are all accessible to designers focusing on API level 28 or more. 

For test code that utilizes notices, including Android 9 highlights, see the Android Notifications Sample. 

Improved informing experience 

Beginning in Android 7.0 (API level 24), you could add an activity to answer to messages or enter other content legitimately from a notice. Android 9 improves this element with the accompanying upgrades:
Disentangled help for discussion members: The Person class is utilized to distinguish individuals engaged with a discussion, including their symbols and URIs. Numerous different APIs, for example, add Message, presently influence the Person class rather than a CharSequence. The Person class likewise underpins the Builder configuration design. 

Backing for pictures: Android 9 currently shows pictures in Messaging Notifications on telephones. You can utilize set Data on the message to show a picture. The accompanying code bit exhibits how to make a Person and a message containing a picture. 



/Create new Person. 

val sender = Person() 





/Create picture message. 

val message = Message("Picture", time, sender) 

.setData("image/", imageUri) 

val style = Notification.MessagingStyle(getUser()) 

.addMessage("Check this out!", 0, sender) 


Spare answers as drafts: Your application can recover the EXTRA_REMOTE_INPUT_DRAFT sent by the framework when a client incidentally shuts an informing notice. You can utilize this extra to pre-populate text fields in the application so clients can complete their answer. 

Recognize if a discussion is a gathering discussion: You can utilize set Group Conversation to deliberately distinguish a discussion as a gathering or non-bunch discussion. 

Set the semantic activity for a plan: The set SemanticAction strategy permits you to give semantic significance to an activity, for example, "mark as read," "erase," "answer, etc. 

SmartReply: Android 9 backings the equivalent proposed answers accessible in your informing application. Use RemoteInput.setChoices() to give a variety of standard reactions to the client. 

Channel settings, communicates, and Do Not Disturb 

Android 8.0 presented Notification Channels, permitting you to make a client adaptable channel for each kind of warning you need to show. Android 9 improves warning channel settings with these changes: 

Blocking channel gatherings: Users would now be able to square whole gatherings of channels inside the warning settings for an application. You can utilize the is Blockedtechnique to distinguish when a gathering is blocked and, therefore, not send any notices for directs in that gathering. 

Moreover, your application can question for current channel bunch settings utilizing the new get Notification Channel Group strategy. 

New communicate plan types: The Android framework currently sends communicate aims when the blocking condition of warning channels and channel gatherings' changes. The application that claims the blocked channel or gathering can tune in for these goals and respond likewise. For additional data on these expectation activities and additional items, allude to the refreshed constants list in the NotificationManager reference. For data on responding to communicate goals, allude to Broadcasts. 

Multi-camera backing and camera refreshes 

On gadgets running Android 9, you can get to streams at the same time from at least two physical cameras. On gadgets with either double front or double back cameras, you can make inventive highlights unrealistic with only a solitary camera, for example, consistent zoom, bokeh, and sound system vision. The API additionally lets you call a legitimate or intertwined camera stream that naturally switches between at least two cameras. 

Different enhancements in camera incorporate extra Session boundaries that help to diminish delays during beginning catch, and surface sharing that lets camera customers handle different use cases without the need to stop and start camera gushing. We've likewise included APIs for show based glimmer backing and access to OIS timestamps for application level picture adjustment and enhancements. 

In android 9 the multi-camera API underpins monochrome cameras for gadgets with FULL or LIMITED capacity. Monochrome yield is accomplished through the YUV_420_888 design with Y as grayscale, U (Cb) as 128, and V (Cr) as 128. 

Android 9 additionally empowers support for outside USB/UVC cameras on bolstered gadgets. 

ImageDecoder for drawables and bitmaps 

Android 9 presents the Image Decoder class, which gives a modernized way to deal with unraveling pictures. Utilize this class rather than the Bitmap Factory and BitmapFactory.Options APIs. 

Image Decoder lets you make a Drawable or a Bitmap from a byte support, a document, or a URI. To decipher a picture, first call createSource with the wellspring of the encoded picture. At that point, call decode Drawable or decode Bitmap by passing the ImageDecoder.Source article to make a Drawable or a Bitmap. To change the default settings, pass On Header Decode dL is tener to decode
Drawable or decode Bitmap. ImageDecoder calls onHeader  Decoded with the picture's default width and tallness, when they are known. On the off chance that the encoded picture is a vivified GIF or WebP, decode Drawable restores a Drawable that is a case of the Animated Image Drawable class. 

There are various techniques you can use to set picture properties: 

To scale the decoded picture to a precise size, pass the objective measurements into setTargetSize(). You can likewise scale pictures utilizing an example size. Pass the example size straightforwardly to set Target Sample Size. 
To edit a picture inside the scope of the scaled picture, call setCrop. 
To make an impermanent bitmap, pass valid into set Mutable  Required. 
ImageDecoder additionally lets you add redid and confused impacts to a picture, for example, adjusted corners or circle veils. Use setPostProcessor() with a case of the PostProcessor class to execute whatever drawing orders you need. 

Note: When you post-process an Animated Image Drawable, the impacts show up in all casings of the movement. 


Android 9 presents the Animated Image Drawable class for drawing and showing GIF and WebP vivified pictures. Animated Image Drawable works also to AnimatedVectorDrawable in that the render string drives the live iness of Animated Image Drawable. The render string additionally utilizes a specialist string to unravel, so deciphering doesn't meddle with different procedure on the render string. This execution permits your application to show a vivified picture without dealing with its updates or meddling with different occasions on your application's UI string.
An AnimatedImageDrawable can be decoded utilizing an example of ImageDecoder. The accompanying code bit tells the best way to utilize Image Decoder to interpret your Animated Image Drawable: 
private fun decode Image() { 

val decodedAnimation = ImageDecoder.decodeDrawable( 

ImageDecoder.createSource(resources, R.drawable.my_drawable)) 

/Prior to begin(), the main edge is shown. 

(decoded Animation as? Animated Image Drawable)?.start() 

ImageDecoder has a few strategies permitting you to additionally alter the picture. For instance, you can utilize the setPostProcessor() technique to change the presence of the picture, for example, applying a circle cover or adjusted corners. 

HDR VP9 Video, HEIF picture pressure, and Media APIs 

Android 9 gives worked in help to High Dynamic Range (HDR) VP9 Profile 2, so you can convey HDR-empowered motion pictures to your clients from YouTube, Play Movies, and different sources on HDR-able gadgets. 

Android 9 likewise includes support for encoding pictures utilizing the High Efficiency Image File design (HEIF or HEIC), which improves pressure and decreases extra room and system information use. HEIF still picture tests are bolstered in the MediaMuxer and MediaExtractor classes. With stage support on Android 9 gadgets, it's anything but difficult to send and use HEIF pictures from your backend server. After you've ensured that your application is good with this information group for sharing and show, check out HEIF as a picture stockpiling position in your application. You can do a jpeg-to-heic transformation utilizing ImageDecoder or BitmapFactory (which gets a bitmap from a JPEG record). You would then be able to utilize HeifWriter to compose HEIF still pictures from YUV byte cushions, or occurrences of Surface or Bitmap. 

Media measurements are additionally accessible from the AudioTrack, AudioRecord, and MediaDrm classes. 

Android 9 acquaints strategies with the MediaDRM class to get measurements, HDCP levels, security levels, and number of meetings, and to include more authority over security levels and secure stops. See the API Diff report for subtleties. 

In Android 9, the AAudio API includes support for a few extra AAudioStream characteristics, including utilization, content sort, and info preset. Utilizing these properties, you can make streams that are tuned for VoIP or camcorder applications. You can likewise set the meeting ID to relate an Audio stream with a submix that can incorporate impacts. Utilize the Audio Effect API to control the impacts. 

Android 9 presents the AudioEffect API for elements handling. With this class, you can construct channel-based sound impacts—including evening out, multi-band pressure, and limiter—over different stages. The quantity of groups and dynamic stages is configurable, and most boundaries can be controlled progressively. 

Information cost affectability in JobScheduler 

Starting in Android 9, JobScheduler can utilize organize status signals gave via bearers to improve the treatment of system related employments. 

Occupations can proclaim their evaluated information size, signal prefetching, and determine nitty gritty system necessities. JobScheduler then oversees work as indicated by the system status. For instance, when the system flags that it is blocked, JobScheduler may concede enormous system demands. When on an unmetered arrange, JobScheduler can run prefetch employments to improve the client experience, for example, by prefetching features. 

When including employments, make a point to utilize setEstimatedNetworkBytes, set Prefetch, and set Required Network when suitable to help JobScheduler handle the work appropriately. At the point when your activity executes, make certain to utilize the Network object returned by JobParameters.getNetwork(). Else you'll verifiably utilize the gadget's default organize which may not meet your necessities, causing unintended information use. 

Neural Networks API 1.1 

The Neural Networks API was presented in Android 8.1 (API level 27) to quicken on-gadget AI on Android. Android 9 extends and improves the API, including support for nine new activities: 

Component shrewd scientific tasks: 



Exhibit tasks: 








Alert: Android Protected Confirmation doesn't give a safe data channel to the client. Your application can't expect any classification ensures past those that the Android stage offers. Specifically, don't utilize this work process to show touchy data that you wouldn't normally appear on the client's gadget. 

For direction on including support for Android Protected Confirmation, see the Android Protected Confirmation control.
Bound together biometric validation exchange 

In Android 9, the framework gives biometric confirmation exchanges for the benefit of your application. This usefulness makes a normalized look, feel, and situation for the exchange, giving clients more certainty that they're confirming against a trusted biometric certification checker. 

In the event that your application utilizes FingerprintManager to show a unique mark validation discourse to clients, change to utilizing Biometric Prompt. Biometric Prompt depends on the framework to show the validation discourse. It additionally changes its conduct to adjust to the sort of biometric verification that a client has picked. 

Note: Before utilizing Biometric Prompt in your application, you should initially utilize the hasSystemFeature() technique to guarantee that the gadget underpins FEATURE_FINGERPRINT, FEATURE_IRIS, or FEATURE_FACE. On the off chance that a gadget doesn't bolster biometric validation, you can fall back to checking the client's PIN, example, or secret key utilizing the createConfirmDeviceCredentialIntent() technique. 

Equipment security module 

Upheld gadgets running Android 9 or higher introduced can have a StrongBox Keymaster, a usage of the Keymaster HAL that lives in an equipment security module. The module contains the accompanying: 

Its own CPU. 

Secure capacity. 

A genuine irregular number generator. 

Extra systems to oppose bundle altering and unapproved sideloading of applications. 

When checking keys put away in the StrongBox Keymaster, the framework substantiates a key's uprightness with the Trusted Execution Environment (TEE). 

To get familiar with utilizing Strongbox Keymaster, see Hardware Security Module. 

Secure key import into Keystore 

Android 9 gives extra key unscrambling security by adding the capacity to import encoded enters safely into the Keystore utilizing an ASN.1‑encoded key arrangement. The Keymaster at that point unscrambles the keys in the Keystore, so the substance of the keys never shows up as plaintext in the gadget's host memory. 

Note: This component is upheld just on gadgets that transport with Keymaster 4 or higher. 

Become familiar with how to Import scrambled keys all the more safely. 

APK signature conspire with key revolution 

Android 9 includes support for APK Signature Scheme v3. This plan has the alternative to incorporate a proof-of-pivot record in its marking obstruct for each marking testament. This capacity empowers your application to be marked with another marking authentication by connecting the APK document's past marking endorsements to the one with which it is currently marked. 

Note: Devices running Android 8.1 (API level 27) or lower don't bolster changing the marking authentication. In the event that your application's minSdkVersion is 27 or lower, utilize an old marking endorsement to sign your application notwithstanding the new signature. 

Learn more on the best way to turn keys utilizing apksigner. 

Choice to permit key unscrambling just on opened gadgets 

Android 9 presents the unlockedDeviceRequired banner. This choice decides if the Keystore requires the screen to be opened previously permitting unscrambling of any in-flight or put away information utilizing the predetermined key. These kinds of keys are appropriate for scrambling touchy information to store on plate, for example, wellbeing or venture information. The banner gives clients a higher affirmation that the information can't be decoded while the gadget is bolted should their telephone be lost or taken. 

Note: When the unlockedDeviceRequired banner is empowered, encryption and mark confirmation can in any case occur whenever. The banner forestalls just unscrambling of information when the gadget is opened. 

To keep a key safe from decoding while the gadget is bolted, empower the banner by passing consistent with the setUnlockedDeviceRequired() technique. Subsequent to finishing this progression, when the client's screen is bolted, any endeavors to unscramble or sign information utilizing this key fizzle. A bolted gadget requires a PIN, secret phrase, unique mark, or some other believed factor before it tends to be gotten to.
Heritage encryption support 

Android 9 gadgets that transport with Keymaster 4 help the Triple Data Encryption Algorithm, or Triple DES. On the off chance that your application interoperates with inheritance frameworks that require Triple DES, utilize this sort of figure while encoding delicate certifications. 

To become familiar with how to make your application progressively secure, see Security for Android Developers. 

Expostulation of WPS 

Wi-Fi Protected Setup (WPS) is deplored for security reasons. 

Android reinforcements 

Android 9 includes new usefulness and designer alternatives identified with reinforcement and reestablish. Insights regarding these progressions show up in the accompanying segments. 

Customer side encryption reinforcements 

Android 9 includes support for scrambling Android reinforcements with a customer side mystery. This help is empowered naturally when the accompanying conditions are met: 

The client has empowered reinforcement utilizing Android 9 or higher. 

The client has set a screen lock for their gadget that requires a PIN, example, or secret key to open. 

At the point when this security measure is empowered, the gadget's PIN, example, or secret key is required to reestablish information from the reinforcements made by the client's gadget. To get familiar with the innovation behind this element, see the Google Cloud Key Vault Service whitepaper. 

Characterize gadget conditions required for reinforcement 

On the off chance that your application information incorporates touchy data or inclinations, Android 9 enables you to characterize the gadget conditions under which your application's information is remembered for the client's reinforcement, for example, when customer side encryption is empowered or a neighborhood gadget to-gadget move is occurring. 

To become familiar with sponsorship up information on Android gadgets, see Data Backup Overview. 


Android 9 acquaints upgrades with the openness structure that make it simpler to give far and away superior encounters to clients of your application. 

Route semantics 

Traits included Android 9 make it simpler for you to characterize how openness administrations, particularly screen perusers, explore starting with one piece of the screen then onto the next. These qualities can help clients who are outwardly weakened rapidly travel through content in your application's UI and permit them to make a choice. 

For instance, in a shopping application, a screen peruser can assist clients with exploring legitimately starting with one classification of arrangements then onto the next, without the screen peruser perusing all things in a class before proceeding onward to the following. 

Availability sheet titles 

In Android 8.1 (API level 27) and lower, availability administrations can't generally decide when a particular sheet of the screen was refreshed, for example, when an action replaces one piece with another section. Sheets comprise of intelligently gathered, outwardly related UI components that regularly involve a section. 

In Android 9, you can give availability sheet titles, or exclusively recognizable titles, for these sheets. On the off chance that a sheet has an openness sheet title, availability administrations get progressively nitty gritty data when the sheet changes. This capacity permits administrations to give progressively granular data to the client about what's changed in the UI. 

To determine the title of a sheet, utilize the android:accessibility PaneTitle quality. You can likewise refresh the title of a UI sheet that is supplanted at runtime utilizing set Accessibility Pane Title. For instance, you could give a title to the substance zone of a Fragment object. 

Heading-based route 

On the off chance that your application shows printed content that incorporates sensible headings, set the android:accessibility Heading ascribe to valid for the cases of View that speak to those headings. By including these headings, you permit availability administrations to assist clients with exploring legitimately starting with one heading then onto the next. Any openness administration can utilize this capacity to improve clients' UI route understanding. 

Gathering route and yield 

Screen perusers have generally utilized the android:focusable ascribe to decide when they should peruse a ViewGroup, or an assortment of View objects, as a solitary unit. That way, clients could comprehend that the perspectives were intelligently identified with one another. 

In Android 8.1 and lower, you have to check each View object inside a ViewGroup as non-focusable and the ViewGroup itself as focusable. This plan made a few occasions of View be checked focusable such that made console route progressively unwieldy. 

Beginning in Android 9, you can utilize the android:screen Reader Focusable quality instead of the android:focusable property in circumstances where making a View object focusable has unwanted outcomes. Screen perusers place center around all components that have set either android:screen Reader Focusable or android:focusable to valid. 

Comfort activities 

Android 9 includes support for performing comfort activities in the interest of clients: 

Cooperation with tooltips 

Included highlights in the availability system give you access to tooltips in an application's UI. Use getTooltipText() to peruse the content of a tooltip, and utilize the ACTION_SHOW_TOOLTIP and ACTION_HIDE_TOOLTIP to educate cases of View to show or cover up their tooltips. 

Included worldwide activities 

Android 9 presents support for two extra gadget activities in the AccessibilityService class. Your administration can assist clients with locking their gadgets and take screen captures utilizing the GLOBAL_ACTION_LOCK_SCREENand GLOBAL_ACTION_TAKE_SCREENSHOT activities, separately. 

Window change subtleties 

Android 9 makes it simpler to follow updates to an application's windows when an application redraws different windows all the while. At the point when a TYPE_WINDOWS_CHANGED occasion happens, utilize the get Window Changes() API to decide how the windows have changed. During a multiwindow update, every window delivers its own arrangement of occasions. The getSource() technique restores the root perspective on the window related with every occasion. 

In the event that an application has characterized openness sheet titles for its View protests, your administration can perceive when the application's UI is refreshed. At the point when a TYPE_WINDOW_STATE_CHANGED occasion happens, utilize the sorts returned by get Content Change Types() to decide how the window has changed. For instance, the system can distinguish when a sheet has another title, or when a sheet has vanished. 

Google is focused on improving openness for all Android clients, giving upgrades that empower you to construct administrations, for example, the Talkback screen peruser, for clients with availability needs. To get familiar with how to make your application increasingly available and to assemble openness administrations, see Accessibility. 


To kill inadvertent turns, we've included a mode that sticks the current direction regardless of whether the gadget position changes. Clients can trigger revolution physically when required by squeezing a catch in the framework bar. 

The similarity impacts for applications are insignificant by and large. In any case, if your application has any altered revolution conduct or uses any abnormal screen direction settings, you may run into issues that would have gone unnoticed previously, when client pivot inclination was constantly set to representation. We urge you to investigate the turn conduct in all the key exercises of your application and ensure that the entirety of your screen direction settings are as yet giving the ideal experience. 

For additional subtleties, see the related conduct changes. 

Another revolution mode lets clients trigger pivot physically when required utilizing a catch in the framework bar. 


Android 9 brings the accompanying content related highlights to the stage: 

Precomputed Text: The PrecomputedText class improves text-rendering execution by empowering you to process and reserve the necessary data early. It additionally empowers your application to perform text design off the principle string. 

Magnifier: The Magnifier class is a stage gadget that gives a magnifier API, taking into account a reliable magnifier-include understanding over all applications. 

Savvy Linkify: Android 9 improves the TextClassifier class, which use AI to distinguish a few elements in chose message and recommend activities. For instance, TextClassifier can empower your application to identify that the client has chosen a telephone number. Your application could then propose that the client make a call utilizing that number. The highlights in TextClassifier supplant the usefulness of the Linkify class. 

Text Layout: Several comfort techniques and ascribes make it simpler to execute your UI plan. For subtleties, see the reference documentation for TextView. 

Workmanship early transformation of DEX records 

On gadgets running Android 9 or higher, the Android runtime (ART) early compiler further advances packed Dalvik Executable configuration (DEX) records by changing over the DEX documents in an application bundle into a progressively minimal portrayal. This change permits your application to begin quicker and devour less circle space and RAM. 

This improvement especially benefits low-end gadgets with more slow plate I/O speeds. 

On-gadget framework following 

Android 9 permits you to record framework follows from your gadget, at that point share a report of these chronicles with your advancement group. This report bolsters various configurations, including HTML. 

By gathering these follows, you can catch timing information identified with your application's procedures and strings and view different sorts of all around critical gadget states.