Saturday, May 4, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1224  / 3 Years ago, mon, may 24, 2021, 12:44:19

I'm using the Ubuntu SDK to develop a QML app that runs both on the desktop and on mobile devices. Depending on where it's running on the desktop or on a device, certain behaviours should be different.



What's the recommended way of programmatically detecting whether an app is running on the desktop or on a mobile device?


More From » application-development

 Answers
6

At the moment the only way to detect it is by checking the Application's width and height. For instance assuming that the phone's widthxheight is 40x71 GU (default portrait), the tablet is 160x100 GU (default landscape), anything that goes above 160x100 GU can be considered as desktop.



There are plans to provide flags to identify for instance whether there is a HW keyboard attached, pointing device, ASO, however those flags should not be used alone to identify a desktop form factor as you can attach mouse/HW keyboard to phone/tablet through bluetooth.


[#30805] Tuesday, May 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ainlyyor

Total Points: 210
Total Questions: 129
Total Answers: 116

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
;