Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in developing some applications for Ubuntu, using the SDK, for converged devices, including phones, tablets, and PCs. How can I detect which device the application is running on, and apply the appropriate layout, including interactivity differences, correctly?

share|improve this question
Don't detect a device type. Detect a screen size and orientation (doable by checking your window size), and lay out appropriately. (Possibly also being able to detect whether touch, mouse, or both would help: I do not know if that is possible.) – sil Apr 5 '13 at 18:12
Unfortunately, none of those factors tell me what layout I should be presenting to the user. – dobey Apr 5 '13 at 18:47
Why don't they? Display a layout appropriate to the space you've got. – sil Apr 5 '13 at 22:32
Because it doesn't say anything about how the device is being used. The converged device solution is also a single device used in all three scenarios, so would obviously need some other way via API to tell the app to change layout. Apps shouldn't be implementing ways to do it themselves, which will break. – dobey Apr 6 '13 at 12:04
I disagree completely. If I have an Ubuntu phone which is plugged into a monitor and keyboard, and the window for my app is on the monitor and is 800px x 500px, then my app should be rendering itself appropriately for that size. If the app is on the phone screen, and is 320px x 480px, then it should be rendering itself appropriately there. That is exactly the same as just changing the size of the window on a desktop. – sil Apr 6 '13 at 13:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.