Combines multiple detection methods for reliability:
User-agent string analysis (most reliable for device type)
Screen dimensions
Touch capability
This ensures mobile controls are shown on:
Standard mobile phones (< 768px width)
High-resolution phones (>= 768px width but mobile user-agent)
Android 15/16 devices with 2K/4K resolutions (1200px+, 1440px+)
Tablets (user preference via touch support)
User-agent detection takes priority over screen size, ensuring that
high-end Android phones with desktop-class resolutions (e.g., Galaxy S23 Ultra,
Pixel 9 Pro) are correctly identified as mobile devices.
Results are cached to avoid re-parsing user-agent on every call.
Cache is invalidated when screen dimensions change.
Detect device type and platform information
Combines multiple detection methods for reliability:
This ensures mobile controls are shown on:
User-agent detection takes priority over screen size, ensuring that high-end Android phones with desktop-class resolutions (e.g., Galaxy S23 Ultra, Pixel 9 Pro) are correctly identified as mobile devices.
Results are cached to avoid re-parsing user-agent on every call. Cache is invalidated when screen dimensions change.