Open In App

How to Use Game Mode API in Android 13?

It has been a really long time since Android has a dedicated game mode of its own, but it appears that Google has finally listened to all the gamers out there. When the user chooses the appropriate game mode, the Game Mode API enables you to optimize your game for the greatest performance or the longest battery life. Three more choices are also available on the game dashboard: a performance profile tuning menu, a shortcut to broadcast your gameplay on YouTube, and a widget with data from Google Play Games integrated. To improve the performance of games that are no longer receiving updates from their developers, you can also submit requests for Game Mode interventions.

You may access the Game Mode API on:



Setup the Game Mode API

Setting up the game mode API is fairly simple, and does not require many steps or tough complications. Follow these steps to incorporate the Game Mode API into your game:

Step #1: Install the Android 13 SDK after downloading it
Declare your app to be a game in the AndroidManifest.xml file by setting the appCategory attribute in the application> element:



android:appCategory="game"

Step #2: Add the following to your main activity to inquire about the current game mode




if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
  // This feature will work only if you are running Android 12+
  GameManager gfgGameManager = Context.getSystemService(GameManager.class);
  
  // Returns the selected GameMode
  int gameMode = gfgGameManager.getGameMode();
}

You can use the table below to understand the various modes available to optimize your game in Android 13:

Particulars

Features

STANDARD Neither a game mode nor standard mode has been chosen by the user.
UNSUPPORTED Both the Game Mode API and Game Mode interventions are not explicitly supported by the game.
PERFORMANCE Offers the lowest latency frame rates but at the cost of fidelity and battery life.
BATTERY The greatest battery life is feasible at the cost of lower fidelity or frame rates.

GeekTip #1: Each game has the option to implement the Game Mode API behavior, suggest options for Game Mode interventions to OEMs, or forego Game Mode interventions altogether.

Ideal Techniques to use GM API

You should choose the proper settings for performance and power-saver modes if your game already supports a variety of quality and frame rate targets:

Image #1: Understanding the Game Mode API in Android 13.

Changing game modes

You can use the Game Dashboard (available on Pixel devices) or comparable programs offered by OEMs to move between the different game modes. As an alternative, you can use the shell command for game mode while developing.

You might need to upload your program to Google Play Console and install it via the Play Store if, while using Game Dashboard, the optimization symbol does not appear when your game runs.

GeekTip #2: It’s important to note that Battery Saver mode is game-specific and has no effect on how Android Battery Saver behaves overall.

Conclusion

This is how we will implement the game Mode API in your devices running Android 13, also note that certain devices have already had the function enabled since the previous Android 12 release.

However using them will purely be based on how your OEM makes your ROM, depending on that the availability of this feature could be absent from your RAM. We believe that the stock ROMs would be carrying this feature, and adding this to your current app, would be a great option.

Article Tags :