ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #17586
Re: Find out if running on a phone
Hi Michi
On 10.01.2016 13:11, Michi Henning wrote:
> I’d like to find out (at run time, from C++), whether I’m running on a phone/tablet as opposed to a desktop.
>
> Is there any way to do that?
>
> Checking for Arm isn’t good enough, because a Chromebook runs on Arm, but isn’t a phone or tablet.
>
> Or, to put it differently, I’d like to find out whether I’m running in a touch environment as opposed to a desktop environment.
>
> Does anyone have any ideas?
Your app should always assume both, touch and mouse input. Any of those
can appear (and disappear) at any point. Additionally, your app should
scale nicely across different screen/window sizes.
That said, there might be some rare cases where you need info on the
currently connected input devices. We're working on an API for that [1]
which I think Timo is already looking to add to the images, but it's not
landed yet.
In any case, if you want to know if you are "on a phone or on a
desktop", you are probably trying to walk the wrong direction.
[1] https://requests.ci-train.ubuntu.com/#/ticket/763
Hope this helps,
Michael
Attachment:
signature.asc
Description: OpenPGP digital signature
Follow ups
References