In this recipe, you will learn how to determine what operating system your user has installed on their device.
Perform the following steps to detect the installed operating system:
Add the following code to the stack's card:
on preOpenCard local tPlatform, tVersion put the platform into tPlatform put the systemVersion into tVersion answer tPlatform & tab & tVersion titled "Your OS" end preOpenCard
Test your application in the simulator or on an actual device. See the following screenshot for a sample result:
In this recipe, we used two functions to determine the user's device platform and operating system version. The first function, platform
, will return either iphone
or android
, depending on the mobile device being used. The second function, systemVersion
, returns the numeric and decimal (that is 7.0.1) version of the user's OS.