ClientNativeCodeExecute (Magic xpa 4.x)

« Go Back


Created BySalesforce Service User
Approval Process StatusPublished

ClientNativeCodeExecute (Magic xpa 4.x)

Calls native code defined in a wrapper for Android and iOS devices and sends passed arguments.


ClientNativeCodeExecute ('modulename.functionname', 'argument type string', arg1, arg2, ...)


modulename.functionname – The module and function names from the native code.

Argument type string – A string in which each character represents the type of argument. The last character represents the type of the return value of the function.
The argument types are:

  • 1 – Char

  • 2 – Short

  • 4 – Int

  • F – Float

  • 8 – Double

  • 0 – Void

  • A – Null terminated string pointer

  • B – Boolean

Arg1, Arg2, ... – The function arguments from the native code.


The return value of the function in the native code.



Calls the method named myfunc in the myclass class, sends it a Numeric value and variable A, which contains a string value and returns a string value.

This syntax replaces the previous convention of using: ClientOSEnvGet('Device_udf|myfunc_123_'&A) and then parses the string in the user defined function.


  • This is a client-side function that is only available for Rich Client tasks.

  • For this function, there is no Magic xpa casting between primitive types, such as a string and a numeric.

  • Only the return value will be returned to Magic xpa. Any modifications made to the variables sent will not be reflected in Magic xpa.

  • You can only call static native code functions.

  • For iOS devices, although you are sending several different parameters to the method, you need to define the called method with only one parameter of NSArray type. All of the Magic xpa parameters are automatically set into this array.


This function is not supported in Web Client tasks.

See also:

How Do I Use Native OS Code in My Mobile Application?

Using Native OS Code in Mobile Applications

The Rich Client Samples project (programs RNC08 and RNC09)

Since version:2.5