← Back to team overview

ubuntu-phone team mailing list archive

Re: Find out if running on a phone

 



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