ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #17643
Re: Find out if running on a phone
But dynamically changing between a desktop and a phone doesn't make, eg,
the accelerometer appear and disappear.
So if you have code that says "if phone: use accelerometer", can you see
how broken that is? Plugging in a screen and keyboard will effectively
disable your accelerometer, because your code assumes desktops don't have
those.
You should absolutely not be writing code that makes assumptions about what
features desktops have or what phones have.
You need to detect the feature itself and use it if you have it.
On Jan 11, 2016 12:08 PM, "Lorn Potter" <lorn.potter@xxxxxxxxxxxxx> wrote:
>
>
> On 12/01/16 05:35, Robert Park wrote:
>
>> But the point is that you can't have coffee that says "if desktop: x; if
>> phone: y" because it can change at any time and you can't rely on that.
>>
>
> Yes this desktop/phablet mode thing would be dynamic. It can change at any
> time, which is why it needs to be detected dynamically.
>
> When you connect bt keyboard & external display, phone is now in desktop
> mode. When you flip back your laptop's touchscreen, it's it now phablet
> mode. It already does the first one except there is no API to let
> developers know for certain what mode it is in.
>
>
>> **MUCH** better user experience if you do feature detection, eg "if
>> push_notifications_available: enable_push_notifications()", this way
>> they work everywhere they exist, rather than trying to guess whether or
>> not they exist by making assumptions about what is a "phone" vs what is
>> a "desktop".
>>
>>
> It really depends on what you are doing.
>
> We can either provide an API to do so or developers will try and guess
> these things on their own.
>
Follow ups
References
-
Find out if running on a phone
From: Michi Henning, 2016-01-10
-
Re: Find out if running on a phone
From: Michael Zanetti, 2016-01-10
-
Re: Find out if running on a phone
From: Michi Henning, 2016-01-10
-
Re: Find out if running on a phone
From: Michael Zanetti, 2016-01-10
-
Re: Find out if running on a phone
From: Michi Henning, 2016-01-11
-
Re: Find out if running on a phone
From: Michael Zanetti, 2016-01-11
-
Re: Find out if running on a phone
From: Michi Henning, 2016-01-11
-
Re: Find out if running on a phone
From: Michael Zanetti, 2016-01-11
-
Re: Find out if running on a phone
From: Michi Henning, 2016-01-11
-
Re: Find out if running on a phone
From: Thomas Voß, 2016-01-11
-
Re: Find out if running on a phone
From: Michael Zanetti, 2016-01-11
-
Re: Find out if running on a phone
From: Jani Monoses, 2016-01-11
-
Re: Find out if running on a phone
From: Michael Zanetti, 2016-01-11
-
Re: Find out if running on a phone
From: Jani Monoses, 2016-01-11
-
Re: Find out if running on a phone
From: Stephen M. Webb, 2016-01-11
-
Re: Find out if running on a phone
From: Lorn Potter, 2016-01-11
-
Re: Find out if running on a phone
From: Stephen M. Webb, 2016-01-11
-
Re: Find out if running on a phone
From: Lorn Potter, 2016-01-11
-
Re: Find out if running on a phone
From: Robert Park, 2016-01-11
-
Re: Find out if running on a phone
From: Lorn Potter, 2016-01-11