Is a Galaxy Tab A a tablet or a mobile?

  • I have a 30 panoarma tour which uses the mutually exclusive device.desktop device.tablet and device.mobile to make presentation decisions. With mobiles having such small screens they offer reduced menus and reduced captions, basically trading off screen space for operability, always hoping the mobile users will come back on a bigger screen for a better experience. Basically the full tour operates on desktop and tablet (web-vr is also enabled and operates where supported).

    The logic to control this uses extensively device.desktop device.tablet and device.mobile as the they are mutually excusive

    Using krpano 1.21, The SAMSUNG GALAXY TAB A running Android 11 reports that it is a mobile, when I would have expected it to be a Tablet?

    What is the preferred logic for this, would it be better using the screen size as the key attribute

    James

    Edited once, last by james (June 4, 2024 at 1:11 AM).

  • The mobile detection depends on the browsers user-agent string - when it contains 'Android Mobile', it is considered to be a mobile device, and otherwise a tablet device.

    The physical screen-size information is not available in the browser and therefore can't be used as mobile/tablet decision.

    If you know the user-agent string of your device (e.g. check https://www.whatsmyua.info/), you could add code like this to force a certain mobile/tablet detection for a specific device:

    Code
    <set var="device.mobile" val="true" if="indexof(browser.useragent,'GALAXY TAB A') GT 0" />
    <set var="device.tablet" val="false" if="indexof(browser.useragent,'GALAXY TAB A') GT 0" />

    Note - instead of 'GALAXY TAB A' from the example code above, use an actual string from the user-agent that identifies the device.

  • Thanks Klaus,

    I am rather shying away from a solution that involves maintaining a list of devices, it's not clear whether the market is keen on these variants - the big mobile, or maybe its a Tablet with phone? The tester who pointed this out says he personally sees the use of this device as a phone as an "option" and has no intention of adding a SIM. So behavour changes with user?

    What I'm trying to achieve is a simpler, smaller, user interface, for small screens. We all knowthat small screens are not the best way to view VR but hopefully you can get people interested enough to "go large" on anther device.

    Primarily it's eth screen size so I implemented this:

    Code
    	<action name="check4Stagesizee">
    	  		jsget(krpW, 'window.innerWidth' );
    	  		jsget(krpH,'window.innerHeight' );
    			calc(krpDiagonal, ((krpW * krpW) + (krpH * krpH)));

    There are a number of screen and window variables to choose from. the result krpdiagonal is the square of the diagonal pixel count and it is used to make GUI decisions. I didn't take the square root of the result as that calculation takes time and I dont care in my application.

    James

  • don't forget to consider device.pixelratio if you do smth like that on your own.

    but in general it is maybe better to use an established device detection framework

    these libs are specialised on this. just search the web.

    Detecting Mobile vs. Desktop Browsers in JavaScript
    Detecting the type of device a user is browsing from is essential for many reasons, such as optimizing content for mobile or desktop…
    medium.com
  • Thanks for the links to the plugins. Interesting and useful.

    In the end I used a bit of everything, one solution doesn’t fit all. It depends what, in the end, the information is for. E,g. You may want to style a page differently to suit a small screen, or you may want to know if the device can be connected to a 5G network, etc.

    James

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!