Android developmentAndroid tutorial

Android 13 Features and APIs first developer preview :

Android 13 Features and APIs first developer preview :
118views

Android 13 Features and APIs first developer preview :  Android 13 introduces great new features and APIs that developers can use. The following sections will help you discover the new features available for your apps , and also get you acquainted with the APIs that are related.

For a complete list of the new, modified APIs, as well as those that have been removed you can read this the API report on diffs. For information about new APIs go to this page for the Android API Reference New APIs are highlighted for easy identification. Additionally, for information on areas where changes to the platform could impact your apps, make certain to look into Android 13 behavior changes for apps that support Android 13.

 Android 13 Features and APIs User experience

android 13 feature

Themes of icons of apps

Beginning with Android 13 users are able to select themed icons for their apps. This feature lets icons for apps in compatible Android launchers are tinted so that they take on the hue of the user’s wallpaper and themes.

To be able to support this feature your app must have an app icon that is monochromatic, and be able to point it out from the component in the manifest. If the user has enabled the Themes-themed icons switch on their device to switch off their device, the system utilizes the hue of the background and the theme for determining the color of the tint that it applies to the icon of the app that is monochromatic.

Specifications

The icon for your monochromatic app must be in line with the following requirements:

  • It must be an drawable VectorDraw.
  • We suggest that your logo fit inside a 36×36 DPP space inside an 90 x 90 dp container. If the logo is required to be bigger then it should be as large as 60 by 60 dp.
  • We suggest flat logos. If your logo is 3D, you could apply Alpha gradients.

The majority of apps can use the vector drawable that is used in notifications.

The following illustration depicts a monochromatic symbol for the Google application that has dotted lines that represent the boundary between the logo area and the container. The boundaries shown here are to illustrate purposes only and are not scaled to scale.

1 . Container space (90 90×90 dp).

2 . Logo space (36 inches x 36 dots ) recommended 60 x 60 pixels maximum).

Create a theme-based app icon

Add the monochrome android: drawable The reason for this is due to element. For instance the word “element” for instance, res/mipmap-anydpi-v26/ic_launcher.xml 

<adaptive-icon >
    <background android:drawable="..." />
    <foreground android:drawable="..." />
    <monochrome android:drawable="@drawable/myicon" />
</adaptive-icon>

In your manifest file, define the icon using android:icon:

<application
    …
    android:icon="@mipmap/ic_launcher"
    …>
</application>

Quick Settings API for placement

Quick Settings within the notification shade are an efficient option for users to modify settings or take swift actions without having to leave the current application. For apps that offer customized tiles that we’re making it easier for users to find and add your tiles into Quick Settings. Utilizing a brand new tile place API the app will be prompted by the user to add your customized tile to the list available Quick Settings tiles. A new dialog in the system allows the user to add the tile in just one step, without having to leave the app, and instead needing to visit Quick Settings to add the tile.

More support for multilingual users.

Android 13 introduces several features to enhance the experience of apps for multilingual users. are described in the following sections:

Per-app language preferences

In many instances multilingual users choose to set their system language to one of the languages, such as English. However, they wish to choose other languages when using specific applications, such as Dutch, Chinese, or Hindi. To make sure that apps offer an improved experience for the users who use them, Android 13 introduces APIs that let apps choose the language of their choice at the time of running to display on its user interface.

Apps that have customized in-app language pickers may make use of the new APIs to cut down on that amount of code needed to display a language selector in the app. To work with earlier versions of the Android platform we’ll include similar APIs to the upcoming version of our Jetpack libraries.

Applications that don’t allow multiple languages aren’t affected by these modifications.

Visit the page about the language preferences per-app for more information.

Unicode library Updates

Android 13 adds the latest updates in terms of fixes, improvements, and updates which are within Unicode ICU 70Unicode CLDR 40 as well as Unicode 14.0.

Here are two important modifications:

  • English (Canada) en-CA and English (Republic of the Philippines) en-PH both make use of English (United United States) en translation resources when there aren’t any translation resources to use instead in place of English (United UK) en-GB.
  • The plural category of many words was introduced to Spanish Es Italian it Portuguese pt as well as Portuguese (Portugal) the Portuguese pt. Much like French which was added in CLDR version 38 it is utilized to cover huge amounts.

Faster the hyphenation

Hyphenation helps wrap text easier to read and makes your UI more adaptable. In Android 13 we’ve improved the performance of hyphenation to as high as 200%. You can enable it now within the TextView without affecting on rendering speed. To enable faster hyphenation, use the new fullFast or normalFast frequencies in setHyphenationFrequency().

Security and privacy

Photo picker

Android 13 features a updated image selection experience. When your app is launched, using the tool, customers can select certain images and videos to upload to your application, for example profile photos, instead of giving your app the ability to access the entire library of media.

The photo picker gives greater security for users since your application doesn’t need `to explicitly declare runtime permissions. Additionally it comes with a an inbuilt uniform UI for apps that create an improved user experience.

New runtime permissions for near Wi-Fi devices

Android 13 introduces a new runtime permission within the NEARBY_DEVICES permission group that allows apps which manage devices’ connections to access points nearby via Wi-Fi. The apps have to announce the permission change, NEARBY_WIFI_DEVICES when they use a variety of WiFi APIs. Additionally that, so long as the apps don’t draw physical location from Wi-Fi APIs they don’t require a declaration of the permission to access the fine-location permission if they are targeting Android 13 or greater.

Graphics

Programmable shaders

Android 13 adds support for programming RuntimeShader objects and their behavior is defined by the Android Graphics Shading Language (AGSL). AGSL has a lot in common with its syntax with GLSL but is integrated into its Android rendering engine in order to allow for custom the painting experience within the Android canvas and filtering the view content. Android internally utilizes shaders to apply blur effects, blur as well as stretching overscroll and Android 13 enables you to make similar effects that are advanced for your application.

The core functionality

OpenJDK 11 updates

Android 13 is the first step in the process of upgrading Android’s core library to be compatible with the OpenJDK 11 LTS release with the release of library updates as well as Java 11 support for languages for developers of platforms and applications. The library updates that were introduced with Android 13 will also be accessible for Android 12 devices through a Google Play system update to the Mainline Module of the ART.

Android 13 includes the following updates to the libraries that are part of the core:

  • The support for variable keyword to define local variables as well as for parameters lambdas.
  • New methods are available in the String class
    • isBlank()
    • lines()
    • repeat()
    • strip()
    • stripLeading()
    • stripTrailing()
  • Support for Collection.toArray(IntFunction) to make it easier to adapt a collection to an array.
  • The support for the IfPresentOrElse() and isEmpty() orElseThrow() as well as streams() for stream() in java.util Classes Optional, OptionalDouble and OptionalInt and OptionalLong.
  • Extension of support to SocketOptions with re-use for sockets.
  • NullReader, NullWriter, InputStream, OutputStream, and transferTo() Reader functions that can transfer read-only characters to Writers. Writer.
  • The functionality was added for URL encryption and decoding with the Charsets.
  • Charset function to FileReader, FileWriter, PrintStream and PrintWriter.
  • TransferTo() readNBytes(), readAllBytes() as well as writeBytes() functions for ByteArrayInput or OutputStream, and OutputStream or Input.
  • Runtime and compiler support for java.lang.invoke.VarHandle.
  • Changes java.util.concurrent to OpenJDK 11 API by using VarHandle internally.