Can anyone suggest a good strategy for differentiating a tablet from a smartphone? Currently, I'm trying to differentiate them using the "has_cellular_radio" and "is_tablet" capabilities for a mobile phone and tablet respectively. I've been testing by overriding the User Agent setting in Chrome's Developer Tools and have noticed that some tablets seem to have the "has_cellular_radio" capability set to True. For example, the "Firefox 14 -- Android Tablet" user agent string "Mozilla/5.0 (Android; Tablet; rv:14.0) Gecko/14.0 Firefox/14.0" indicates that the device is a tablet and has a cellular radio. The same thing happens for "Chrome -- Android Tablet" with ua = "Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19". I guess one option would just be to assume a device is a tablet whenever "is_tablet" is True but this could make my code's logic kind of wonky. I've tried subsitituting the virtual capability "is_smartphone" for "has_cellular_radio" and this makes seems to fix the problem but the documentation suggests that this is_smartphone capability may not always be available (in the future). Any thoughts?
With the WURFL Cloud Service, you can certainly use is_smartphone, although it sounds like you are more interested in differentiating tablets from all other wireless/mobile devices. In this case you can use the following logic:
In addition to Steve's answer, I am not sure about the assumption that "has_cellular_radio=true" implies that the device is not a a tablet. There are several counter-examples to this, which include early iPads and early Kindles too.
As far as the definition of smartphone goes, that's a definition that is bound to vary over time, region and personal preferences, so the virtual capability value we provide is simply one arbitrary definition that users may find useful or not. Many do. Others prefer to roll their own definition of what they consider a smartphone based on their specific needs.
To expand on the has_cellular_radio capability, this applies to devices with cellular data access. If you want to tell if the device can make/receive phone calls, you can use can_assign_phone_number, but note that this excludes phone-sized mobile devices like the iPod, Sony PSP, Samsung Galaxy Player, etc.