← Back to team overview

ubuntu-phone team mailing list archive

Re: Find out if running on a phone

 

t

On 11/01/16 23:15, Stephen M. Webb wrote:
On 16-01-11 06:57 AM, Jani Monoses wrote:

     You should not do that... Why do you even want to know?

Whether the app is running on the phone vs desktop?

* to use different QML since the same QML code cannot (yet) work on both
* to use the content-hub for getting a file vs doing a regular file open dialog
* to load contacts from the content-hub vs from another source that is desktop specific
* to enable push notifications or not
* to assume a different role (master or slave device of the same account)

Just so you know, the difference between a desktop and a phone is that when you unplug an external monitor and input
devices from your phone it is no longer a desktop, but a desktop stays a desktop.

If you're developing software *right now* making any other assumptions about phone vs. desktop, you're writing bad code
and breaking things in a highly undesirable way.


I beg to differ. Look at windows 8 as example of assuming they are the same and treating a desktop as a mobile touch device. I hate full screen apps on a beautiful large display, especially when its an 'ok/cancel' dialog. I have a 2 in 1 laptop with touch. It would be nice if I could use it in tablet mode when folded up (virtual keyboard opens, bigger buttons/scroll bars/font).

Detecting if toushscreen is available only won't work in this day and age. Going by screen size won't work. Either we put something in the filesystem/API for phablet/desktop mode or developers simply have to guess. Detecting for user phablet or /home/phablet might work in a pinch, if there are assumptions about this user in the system (and OEM's cannot change it) on phablet but won't work on my laptop when folded up.


imho, we need some way that contained apps know if the device is desktop or phablet mode, which I assumed the QInputInfo API was helping to detect. Right now, phablet mode becomes desktop mode when adding a bluetooth keyboard. Where as it probably should be keyboard + external display on small display, because windowed mode on small screen is horrible to use.

-
Lorn


Follow ups

References