apk.fm / News / Using performance class to optimize your user experience

Using performance class to optimize your user experience


Posted by Don Turner, Developer Relations Engineer, and Francois Goldfain, Director of Android Media Framework

Illustration of woman on a phone 

Immediately we’re launching the Jetpack Core Efficiency library in alpha. This library lets you simply perceive what a tool is able to, and tailor your consumer expertise accordingly. It does this by permitting you to acquire the system’s efficiency class on gadgets working Android 11 (API degree 30) and above.

A efficiency class is a rating that displays each a tool’s degree of efficiency and its total capabilities. As such, it largely displays the system’s {hardware} specs, but additionally the way it performs in sure real-world situations, verified by the Android Compatibility Check Suite.

The efficiency class necessities presently give attention to media use circumstances. For instance, a Media Efficiency Class 12 system is assured to:

  • have 6+ GB of RAM
  • have a 12+ megapixel rear-facing digicam supporting video seize at [email protected],
  • be capable to initialize a video codec in <50ms even when underneath load
  • and lots of different necessities.

A tool that meets these necessities can optimally deal with many in style media use circumstances together with the standard video pipelines in social media apps for capturing, encoding, and sharing.

As an app developer, this implies you may reliably group gadgets with the identical degree of efficiency and tailor your app’s habits to these completely different teams. This lets you ship an optimum expertise to customers with each extra and fewer succesful gadgets. Efficiency class necessities will increase with every main Android launch, making it attainable to simply goal completely different ranges of expertise to the efficiency class vary you discover applicable. For instance, you may want to tailor “extra premium” and “extra purposeful” experiences to sure efficiency courses.

use efficiency class

So as to add efficiency class to your app, embody the next dependency in your construct.gradle:

implementation 'androidx.core:core-performance:1.0.0-alpha02'

Then use it to tailor your consumer expertise. For instance, to encode greater decision video relying on Media Efficiency Class:

class OptimalVideoSettings(context: Context){

   personal val devicePerf: DevicePerformance = DevicePerformance.create(context)

   val encodeHeight by lazy {
       when (devicePerf.mediaPerformanceClass) {
           Construct.VERSION_CODES.S -> 1080 // On efficiency class 12 use 1080p
           Construct.VERSION_CODES.R -> 720 // On efficiency class 11 use 720p
           else -> 480

   val encodeFps by lazy {
           Construct.VERSION_CODES.S -> 60 // On efficiency class 12 use 60 fps
           Construct.VERSION_CODES.R -> 30 // On efficiency class 11 use 30 fps
           else -> 30

When to make use of efficiency class

The Android system ecosystem could be very numerous. The identical software code can result in very completely different behaviors relying on the system’s capabilities. For instance, encoding a 4K video may take a couple of seconds on one system however a couple of minutes on one other. Person expectations additionally differ vastly primarily based on the system they buy. To supply an optimized consumer expertise, it’s common to group gadgets primarily based on some standards, reminiscent of RAM measurement or 12 months launched, then tailor your app’s options for every group.

The issue with utilizing an arbitrary worth reminiscent of RAM measurement for grouping is that it gives no ensures of a tool’s efficiency. There can even at all times be outliers that carry out higher or worse than anticipated inside that group. Grouping on efficiency class solves this downside because it gives these ensures, backed by real-world exams.

Manually testing gadgets that belong to completely different efficiency courses is one choice to assess and determine the adjustments wanted to steadiness functionalities and value. Nevertheless, the really helpful strategy to validate adjustments within the app expertise is to run A/B exams and analyze their influence on app metrics. You are able to do this with the assist of an experimentation platform reminiscent of Firebase. Offering the system’s efficiency class to the experimentation platform provides a further efficiency dimension to the take a look at outcomes. This allows you to determine the best optimizations for every class of system.

Snap Inc.

Snap has been utilizing system clustering and A/B testing to tremendous tune their expertise for Snapchatters. By leveraging efficiency class, Snapchat confidently identifies system functionality in a scalable approach and delivers an optimum expertise. For instance, the visible high quality of shared movies is elevated through the use of greater decision and bitrate on Media Efficiency Class 12 gadgets than by default. As extra gadgets are upgraded to fulfill Media Efficiency Class, Snapchat will run further A/B exams and deploy options higher optimized for the system capabilities.

Gadget assist

The efficiency class necessities are developed in collaboration with main builders and system producers, who acknowledge the necessity for a easy, dependable, class-based system to permit app optimizations at scale.

Specifically, Oppo, OnePlus, realme, Vivo and Xiaomi have been first to optimize their flagship gadgets to make sure that they meet the Media Efficiency Class 12 necessities. Because of this, Construct.VERSION.MEDIA_PERFORMANCE_CLASS returns Construct.VERSION_CODES.S (the Android 12 API degree) on the next gadgets:

Why a Jetpack library?

The Jetpack Core Efficiency library was launched to increase efficiency class to gadgets not but working Android 12 or not promoting their eligible efficiency class on the time they handed the Android Compatibility Check Suite.

The library, which helps gadgets working Android 11 and above, goals to deal with this. It reviews the efficiency class of many gadgets primarily based on the take a look at outcomes collected through the system certification or by means of further testing executed by the Google group. We’re including new gadgets usually, so ensure you’re utilizing the most recent model of the Core Efficiency library to get most system protection.

Reporting efficiency class to Firebase

When utilizing Firebase as an experimentation platform for A/B exams, it is easy to ship the system efficiency class to Firebase Analytics utilizing a consumer property. Filtering the A/B take a look at reviews by efficiency class can point out which experimental values led to one of the best metrics for every group of gadgets.

Here is an instance of an A/B take a look at which varies the encoding peak of a video, and reviews the efficiency class utilizing a consumer property.

class MyApplication : Utility() {

    personal lateinit var devicePerf: DevicePerformance 
    personal lateinit var firebaseAnalytics: FirebaseAnalytics

    override enjoyable onCreate() {
        devicePerf = DevicePerformance.create(this)
        firebaseAnalytics = Firebase.analytics        

    enjoyable getVideoEncodeHeight() : Lengthy = remoteConfig.getLong("encode_height")

Subsequent steps

We might love so that you can check out the Core Efficiency library in your app. If in case you have any points or function requests please file them right here.

Additionally, we might have an interest to listen to any suggestions you have got on the efficiency class necessities. Are there particular efficiency standards or {hardware} necessities which can be essential to your app’s use circumstances? If that’s the case, please tell us utilizing the Android situation tracker.

Source hyperlink

Take a comment