Function to determine if calling module is in a WEB or MOBILE application

I have some common server actions which are called by both mobile and web applications in my Core Services module, and I would like to identify if the caller is from a MOBILE app, or a WEB application.

I found in the PlatformRuntime_API there is an action called Session_GetMobileAppLoginId.

This action runs correctly, and returns a unique ID when called from a mobile application.
If run from a web application then it returns an exception.

I am trapping the exception and then return TRUE or FALSE for if a mobile user.

But ... every time the function is called from a web application it writes an ERROR to the ERROR LOGS viewable inside ServiceCenter\Monitoring\Errors. And my logs are getting flooded with exceptions.

Is there a way to STOP the Session_GetMobileAppLoginId() from writing an exception to the error log?
Or is there a DIFFERENT function I can use to determine if my server action is being called from a mobile application?

Any ideas?

Hi Alan,

In OutSystems11 we are having the device detection server action from there you can differentiate the call from mobile and web.

Hope it will helps you.



I want to detect from a SERVER ACTION, inside OutSystems 10.

This is NOT for purposes of UI, but rather for business logic at the back-end server action.

Hi Alan,

 These are server actions which you can find in OutSystems 11. These are not the UI elements. If you want to Use in OutSystems 10 Clone this server actions and implement same logic in the OutSystems 10.



Just to clarify - i am NOT trying to detect if the user is running the application on a MOBILE device, vs a DESKTOP device.

I am trying to detect whether the ESPACE that is calling my espace action is from a MOBILE or WEB application.

This is not DEVICE detection, but rather OutSystems application type detection. Is this an OutSystems MOBILE or OutSystems WEB application.

I think your answer is about device detection rather than application type.


Hi Alan ,

Steps to get the espace type from where you are calling to the core server action

1)Create a server action with input parameter espace id 

2)Add an espace aggregate in that server action  and filter that aggregate with espace id then you can get the espace type from where you are calling this server action.

3)Consume this action inside your other espaces where you wan to get the espace type calling this server action, you can set the espace id by using GetOwnerEspaceidentifier() built in function inside outsystems

Hope this will help you .




Ahh. Thanks. I didn't know there was an ESPACEKIND.

That does the trick nicely!