← Back to team overview

ubuntu-phone team mailing list archive

Re: Find out if running on a phone

 


On 11.01.2016 12:57, 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)
> 
> AIUI the convergence work will help with some of these but even that
> won't help if you want a backend part of the app to work both on the
> phone and desktops other that Ubuntu with the convergence supports
> installed (other linuxes, Windows maybe)
> 
> So a way to distinguish between phone and desktop at runtime is
> essential. Whether it is a 100% working method via an official API or a
> good heuristic is not a major concern for me right now.

Ok, what you are doing is to add support for legacy Ubuntu and other
distributions. In that case, yes you need to distinguish legacy vs. new
world. Nothing to do with the form factor tho. When you say desktop, I
still think of unity8, running in windowed mode.

Attachment: signature.asc
Description: OpenPGP digital signature


References