← Back to team overview

ubuntu-phone team mailing list archive

Re: Find out if running on a phone

 

>
>
> 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.

Jani

Follow ups

References