API Levels

Defines functions and constants for working with Android API levels.

Summary

Functions

android_get_application_target_sdk_version()
int
Returns the targetSdkVersion of the caller, or __ANDROID_API_FUTURE__ if there is no known target SDK version (for code not running in the context of an app).
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_application_target_sdk_version

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

Returns the targetSdkVersion of the caller, or __ANDROID_API_FUTURE__ if there is no known target SDK version (for code not running in the context of an app).

The returned values correspond to the named constants in <android/api-level.h>, and is equivalent to the AndroidManifest.xml targetSdkVersion.

See also android_get_device_api_level().

Available since API level 24.

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 values correspond to the named constants in <android/api-level.h>, and is equivalent to the Java Build.VERSION.SDK_INT API.

See also android_get_application_target_sdk_version().