Get OS version number

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Montecri


Is there a way to get the underlaying OS version number, like 4.4.4 for Android?


:bust_in_silhouette: Reply From: funabab

There is no built-in function that will give you this information, but one work around is to use shell command via OS.execute(…) function

func get_os_version_number():
    var out = []
    OS.execute("getprop", [""], true, out)
    return str(out[0])

NOTE: this will only work on android (obviously) :slight_smile:

Great. Thank you!!!

Montecri | 2018-05-01 16:01

This solution doesn’t work. I wonder why Godot didn’t added it to the OS object…

Guy Bashan | 2020-02-07 22:54

Seems this doesn’t work an all phones. Is there another way to get the android version number?

EDIT: My error, is working on all of my devices

TobiLa | 2020-02-12 16:12