genexusgenexus-sd

In Genexus, Know in runtime is Android or IOS


In Genexus, how to know if is compiling for Android or IOS in Smart Device?

Example:

A procedure:

If platform = ‘IOS’
   &Variavel = 1
Else if platform = ‘ANDROID’
   &VARIAVEL = 2
endif

Solution

  • There is no way to know at complie time, but you can check in runtime.

    You can use the DeviceType property in ClientInformation

    &deviceType = ClientInformation.DeviceType
    if &deviceType = SmartDeviceType.iOS
        &variavel = 1
    else // if &deviceType = SmartDeviceType.Android
        &variavel = 2
    endif
    

    See more info in the official documentation: ClientInformation external object