Titanium JIRA Archive
Alloy (ALOY)

[ALOY-117] Identify is a device is "handheld" or "tablet" on all supported platforms

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusResolved
ResolutionFixed
Resolution Date2012-09-12T17:10:35.000+0000
Affected Version/sn/a
Fix Version/s2012 Sprint 19, Release 3.0.0
ComponentsRuntime
Labelsn/a
ReporterTony Lukasavage
AssigneeUnknown
Created2012-07-19T15:38:19.000+0000
Updated2018-03-07T22:26:03.000+0000

Description

Here's a general idea of how it will be performed on each platform. The code below is not what will be used. It has been expanded for clarity and will be more concise and performant in practice, and obviously platform-safe.

iOS (done)

var isIosTablet = Ti.Platform.osname === 'ipad';

Android (done)

var isAndroidTablet = Ti.Platform.osname === 'android' && 
    (Ti.Platform.displayCaps.physicalSizeCategory === 'large' ||
     Ti.Platform.displayCaps.physicalSizeCategory === 'xlarge');
This code relies on the linked issue. I put a PR in place to expose this Android API. Until this API is processed, I will put together an Android module that we can use in Alloy in the meantime. *UPDATE:* Android module found here: https://github.com/tonylukasavage/physicalSizeCategory

Mobileweb (not done)

// we may have to resort to just using the Ti.Platform.displayCaps.platformHeight(Width)
// until an API can be exposed from Mobileweb to allow better size detection.
var isMobilewebTablet = !(Math.max(
    Ti.Platform.displayCaps.platformHeight,
    Ti.Platform.displayCaps.platformWidth
) < 700);

Comments

  1. Russell McMahon 2012-08-28

    Setting a due date. We need to keep following up to make sure Mobile Web implements the feature.
  2. Tony Lukasavage 2012-08-29

    I have been following up. Follow the progress in the linked TIMOB ticket: TIMOB-10492
  3. Tony Lukasavage 2012-09-11

    Bryan has given some advice in the linked ticket. I will implement it and close the ticket.

JSON Source