• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Systrem Version

The thread below is about finding sdk version butt one of the responses gives linux commands for finding android version from the output of the getprop linux command
http://stackoverflow.com/questions/8063461/getting-android-sdk-version-of-a-device-from-command-line
I tried getprop with terminal emulator...no su...it gave big long output which did include my android 4.4.4 version (in two pieces... 4.4 in one place and 4 in another)
You can execute the linux getprop command with tasker shell command. Extract version from getprop output either using that linux string filter syntax from the link, or using tasker variable split command
 
Last edited:
Could you post a simple Task that has the Actions you are recommending?

My reason for needing this is that Silent Mode has three states in 4.4.4 (on/off/vibrate)and two states in 5.1 (off/vibrate). My simple tasks to toggle silent mode in 4.4.4 are not simple in 5.1.

... Thom
 
Sure. I tried the linux grep / awk stuff from the link and it didn't work for some reason, so I used the Tasker splitter command instead. It relies on presence of the string "[ro.build.version.release]:" just before the version in the output from GetProp (which it was for me). If doesn't work for some reason (your output doesn't include that particular string), there are other places where the version was stored (I saw about 5 different places) so there are more splitter options to try. For that matter you could probably test %GetPropOut ~ *4.4* and %GetPropOut ~ *5.1* immediately after A1 and it MIGHT work (as long as those strings don't happen to show up in some other portion of that long long file which doesn't apply to the version number). But the full A1-A4 is safer / more reliable if you can get it to work.

A1: Run Shell [ Command:getprop Timeout (Seconds):0 Use Root:Off Store Output In:%GetPropOut Store Errors In: Store Result In: ]

<So you can paste into another app for inspection if you want>
A2: Set Clipboard [ Text:%GetPropOut Add:Off ]

A3: Variable Split [ Name:%GetPropOut Splitter:[ro.build.version.release]: Delete Base:On ]

A4: Variable Section [ Name:%GetPropOut2 From:1 Length:8 Adapt To Fit:Off Store Result In:%GetPropAndroidVersion ]
 
Last edited:
Thank you very much. This is what I came up with so far ...

tlaVersion
A1: Run Shell [ Command:getprop Timeout (Seconds):0 Use Root:Off Store Output In:%work Store Errors In: Store Result In: ]
A2: Variable Split [ Name:%work Splitter:[ro.build.version.release] Delete Base:On ]
A3: Variable Section [ Name:%work2 From:4 Length:32 Adapt To Fit:Off Store Result In:%work ]
A4: Variable Split [ Name:%work Splitter:] Delete Base:On ]
A5: Return [ Value:%work1 Stop:On ]

tlaVersionTest
A1: Perform Task [ Name:tlaVersion Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable:%work Stop:Off ]
A2: Flash [ Text:%work Long:On ]

Run under 4.4.4 it return 4.4.4
Run under 5.1 it returns 5.1


... Thom
 
Last edited:
There is a much better solution that was pointed out to me. Use %SDK and it has the advantage that you can do math calculations wit it. The values are ...

%SDK -- Release
1 -- 1.0
2 -- 1.1
3 -- 1.5
4 -- 1.6
5 -- 2.0
6 -- 2.0.1
7 -- 2.1
8 -- 2.2
9 -- 2.3
10 -- 2.3.3
11 -- 3.0
12 -- 3.1
13 -- 3.2
14 -- 4.0
15 -- 4.0.3
16 -- 4.1
17 -- 4.2
18 -- 4.3
19 -- 4.4
20 -- 4.4
21 -- 5.0
22 -- 5.1​

So for my current need I can compare ...

%SDK < 22
%SDK = 22
%SDK >22​

... Thom
 
Back
Top Bottom