-
Notifications
You must be signed in to change notification settings - Fork 74
Device and Client Type Checks
After calling dd.Parse(), DeviceDetector exposes a set of convenience boolean helpers so you rarely need to inspect raw match results just to answer "is this a phone?" or "is this a browser?".
dd.IsSmartphone();
dd.IsFeaturePhone();
dd.IsTablet();
dd.IsPhablet();
dd.IsConsole();
dd.IsPortableMediaPlayer();
dd.IsCarBrowser();
dd.IsTv();
dd.IsSmartDisplay();
dd.IsSmartSpeaker();
dd.IsCamera();
dd.IsWearable();
dd.IsPeripheral();Two broader helpers combine several device types:
dd.IsMobile(); // smartphone, feature phone, tablet, phablet, car browser, camera, portable media player, ...
dd.IsDesktop(); // desktop devices (device type unknown/not mobile and OS is a desktop OS)dd.IsBrowser();
dd.IsFeedReader();
dd.IsMobileApp();
dd.IsPIM(); // Personal Information Manager
dd.IsLibrary(); // HTTP client libraries (curl, okhttp, Guzzle, ...)
dd.IsMediaPlayer();dd.IsBot(); // see also the dedicated Bot Detection page
dd.IsTouchEnabled();
dd.HasAndroidTableFragment(); // Android "Tab" UA fragment
dd.HasAndroidMobileFragment(); // Android "Mobile" UA fragment
dd.HasAndroidVRFragment(); // Android "VR" UA fragment
dd.IsParsed(); // whether Parse() has been called and produced a resultGeneric check against any ClientType:
using DeviceDetectorNET.Parser.Client;
dd.Is(ClientType.Browser);
dd.Is(ClientType.FeedReader);
dd.Is(ClientType.Library);
dd.Is(ClientType.MediaPlayer);
dd.Is(ClientType.MobileApp);
dd.Is(ClientType.PIM);
Is(ClientType)(and everyIsX()boolean helper) requiresParse()to have been called first — calling it beforehand throwsAccessViolationException.
Beyond the booleans, the full parsed data is available through:
dd.GetDeviceName(); // e.g. "smartphone"
dd.GetBrandName();
dd.GetModel();
dd.GetOs(); // ParseResult<OsMatchResult>
dd.GetClient(); // ParseResult<ClientMatchResult> — generic client info
dd.GetBrowserClient(); // ParseResult<BrowserMatchResult> — browser-specific info
dd.GetBot(); // ParseResult<BotMatchResult>, null unless IsBot()Each ParseResult<T>.Match carries the strongly-typed match (name, version, and type-specific fields such as engine/family for browsers).
These map 1:1 onto the PHP methods ($dd->isSmartphone(), $dd->getOs(), ...) described in the upstream README — only the casing changes (PascalCase in .NET vs. camelCase in PHP).
DeviceDetector.NET is a .NET port of matomo-org/device-detector · Licensed under Apache 2.0 · Report an issue