[OutSystems UI] Wrong information of  GetDeviceType action
outsystems-ui
Reactive icon
Forge component by Platform Maintenace
Application Type
Reactive

Hello,

I'm running a PWA app on a phone and a tablet and use the GetDeviceType action from the OutSystemsUI module to detect the used device. When I hold these devices in portrait, I get the device type phone and tablet, which are correct. But when I hold these devices in landscape, I get the device type tablet (must be phone) and desktop (must be tablet), which is wrong. How can I get the correct information when I hold these devices in landscape?

The action IsTablet gives the same problem. When I use the tablet in portrait the result value is true, but when i use the tablet in landscape the result value is false. I didn't check the IsPhone action, but i think it will give the same wrong information.

Kind regards

Jan Hidding

mvp_badge
MVP
Solution

Hi Jan,


By your description OutSystemsUI is checking the device type based on width intervals. After opening the clone of OutSystemsUI, the device type is inferred from classes in the HTML. These ones are probably being granted on the width, so the UI can adapt and you'll likely see the same look and feel on phone landscape and on tablet portrait.



In any case, you can check the device via JavaScript by working on the navigation.useragent. The algorithm is available here.


Hope it helps.


Kind Regards,
João


Hi @Jan Hidding,


What João Marques said is correct! In OutSystems UI we just use the classes added by the platform (which are based on screen width).


To make it easier for you, I created a new client action, that detects the real device being used., on the attached oml.


Best regards,

Bernardo Cardoso


GetDeviceType.oml

Thanks Bernado for the oml. It works in my application PWA

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.