Android mobile device detection is too broad

Continuing the discussion from Android mobile device detection is too strict:

So…since @codinghorror’s change went through, Discourse now appears in mobile view for my 10" Samsung Galaxy Tablet (user agent below). According to the link shared in the linked post, Samsung Galaxy tablets currently take second place in for the US share of tablet visits. It has 7%, up from 6% a year before. This data shows 2 things that I think were overlooked: 1, Samsung tablet usage increased year over year, and 2, this is US only. When smartphone OS is looked at on a global scale, Android blows iOS away. I believe the last data from IDC showed Android at over 80%, so I would assume that tablet usage globally is greater than 7% (though still less than Apple).

Data aside, I think catching the second most used tablet is important. While avoiding a 100+ line regex statement is good, this one seems too short…

Mozilla/5.0 (Linux; Android 5.0.2; SM-T800 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.91 Safari/537.36

1 Like

According to:

Mobile Android has “Mobile” string in the User-Agent header.

Adding SM-T into the user agent and GT-P makes me uneasy, I wonder if there are ANY examples in the wild of Android Mobile devices that don’t report the word Mobile in the user agent string.

Also, this is the recommendation by Google

As a solution for mobile sites, our Android engineers recommend to specifically detect “mobile” in the User-Agent string as well as “android.”

To me the big question is, are there more 7’’ Android tablet (that are not ideal on the desktop theme) vs 9’’+ ones.

5 Likes

It is not even remotely the “second” most used tablet. The large tablet Android market is absolutely tiny and borderline irrelevant. The risk and harm to us as a company of not detecting the trillions of rando Android phone devices correctly as small screen “mobile” devices is severe.

I’ll need to check some user agents but if that ancient 2011 recommendation from Google is valid, to key off both Android and Mobile, that could be an option.

But if any percentage of Android phones, even 2 percent, is misdiagnosed by that change, the harm is far greater in terms of audience than the whole of the “tablet” android ghetto.

1 Like

I think the only risk is 7’’ tablets. Phones are safe.

4 Likes

All right, I’ve changed it to

user_agent =~ /Mobile/ && !(user_agent =~ /iPad/)

Let’s just say it’s a mobile device if it is telling us it is one:

Mobile

4 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.