diff options
author | Malcolm Smith <smith@chaquo.com> | 2024-03-27 16:53:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 16:53:27 (GMT) |
commit | 74c8568d07719529b874897598d8b3bc25ff0434 (patch) | |
tree | 43226bc05462471e4c05c7a160335aa3e752d2ea /Doc | |
parent | ce00de4c8cd39816f992e749c1074487d93abe9d (diff) | |
download | cpython-74c8568d07719529b874897598d8b3bc25ff0434.zip cpython-74c8568d07719529b874897598d8b3bc25ff0434.tar.gz cpython-74c8568d07719529b874897598d8b3bc25ff0434.tar.bz2 |
gh-71042: Add `platform.android_ver` (#116674)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/platform.rst | 36 | ||||
-rw-r--r-- | Doc/library/sys.rst | 4 |
2 files changed, 39 insertions, 1 deletions
diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index 4bc3956..6af9168 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -301,3 +301,39 @@ Linux Platforms return ids .. versionadded:: 3.10 + + +Android Platform +---------------- + +.. function:: android_ver(release="", api_level=0, manufacturer="", \ + model="", device="", is_emulator=False) + + Get Android device information. Returns a :func:`~collections.namedtuple` + with the following attributes. Values which cannot be determined are set to + the defaults given as parameters. + + * ``release`` - Android version, as a string (e.g. ``"14"``). + + * ``api_level`` - API level of the running device, as an integer (e.g. ``34`` + for Android 14). To get the API level which Python was built against, see + :func:`sys.getandroidapilevel`. + + * ``manufacturer`` - `Manufacturer name + <https://developer.android.com/reference/android/os/Build#MANUFACTURER>`__. + + * ``model`` - `Model name + <https://developer.android.com/reference/android/os/Build#MODEL>`__ – + typically the marketing name or model number. + + * ``device`` - `Device name + <https://developer.android.com/reference/android/os/Build#DEVICE>`__ – + typically the model number or a codename. + + * ``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's + a physical device. + + Google maintains a `list of known model and device names + <https://storage.googleapis.com/play_public/supported_devices.html>`__. + + .. versionadded:: 3.13 diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 087a345..19d6856 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -753,7 +753,9 @@ always available. .. function:: getandroidapilevel() - Return the build time API version of Android as an integer. + Return the build-time API level of Android as an integer. This represents the + minimum version of Android this build of Python can run on. For runtime + version information, see :func:`platform.android_ver`. .. availability:: Android. |