Get the API Level of the device

This is an extension to get the API level of the device from the Android version that is currently running.

de.bodymindpower.GetApiLevel.aix (4.8 KB)

That's all:

grafik

Update (Dec. 30, 2021, ver 3):
GetApiLevel_3.aix (5.0 KB)

14 Likes

Wow, I really need this extension, Thank you for making this extension Mrs.@Anke

1 Like

Nice extension!!

1 Like

(added to FAQ)

2 Likes

Simple but powerful.

2 Likes

Helpful extension! @Anke

2 Likes

I added get Android Version:

de.bodymindpower.GetApiLevel_2.aix (5.0 KB)

6 Likes

Wow. This is very useful, especially for now on android 10 and 11 changes.
Thank you, Anke!

1 Like

Am I understanding this correctly .. using AI Companion Do It on the "getAndroidVersion" block returns a value in quotes, designating that it is a string and not a numeric value? That's fine with me, I just want to know how to use the value when its returned..

@Anke might want to update the extension and follow the naming conventions..
rather than getAndroidVersion the property could be renamed to just AndroidVersion

App Inventor does not distinguish between strings and numeric values... just use it as you like to use it... just give it a try...

Taifun

You do not have to use an extension. The Screen on nb188 has the following Blocks:

Platform gets the name of the underlying platform running the app. Currently, this is the text “Android”. Other platforms may be supported in the future.

PlatformVersion gets the version number of the platform running the app. This is typically a dotted version number, such as 10.0. Any value can be returned, however, so you should take care to handle unexpected data. If the platform version is unavailable, the empty text will be returned.

Done (version 3, Dec. 30, 2021):
GetApiLevel_3.aix (5.0 KB)

1 Like

So, MIT needs to update the documentation. It identifies ios platform. :astonished: so this might be the future. :slight_smile:

Version

and provides Android Version of the device it is running on. :slight_smile:

Dear Anke,
thank you very much for your invaluable help proving the GetApiLevel_3.aix. After a lot of troubles, it was the only worked for me ...