API Levels

Defines functions for working with Android API levels.

Summary

Functions

android_get_device_api_level()
int
Returns the API level of the device we're actually running on, or -1 on failure.

Functions

android_get_device_api_level

Declared in android/api-level.h
int android_get_device_api_level()

Returns the API level of the device we're actually running on, or -1 on failure.

The returned value is the same as the Java Build.VERSION.SDK_INT. This is mostly useful for an app to work out what version of the OS it's running on. See also android_get_application_target_sdk_version().

Available since API level 29.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026年08月27日 UTC.