Many Android Developers or websites may question how to differentiate UA between Android phone and Android pad. It is true that this problem is very difficult. I was also troubled for a while, and later found a solution in stackoverflow.
Answer:
Mobile android has "mobile" in the User-Agent. tablet Android does not.
Explanation:
Here's a trending User-Agent Detection misstep we hope to help you prevent: while it seems completely reasonable to key off the string "android" in the User-Agent and then redirect users to your mobile version,
There's a small catch... Android tablets were just released! Similar to mobile, the User-Agent on Android tablets also contains "Android," yet tablet users usually prefer the full desktop version over the mobile equivalent. If your site matches "Android" and
Then automatically redirects users, you may be forcing Android tablet users into a sub-optimal experience.
As a solution for mobile sites, our android engineers recommend to specifically detect "mobile" in the User-Agent string as well as "android." Let's run through a few examples.
With a User-Agent like this:
Mozilla/5.0 (Linux; U; Android 3.0; en-US; xoom build/hri39) applewebkit/534.13 (khtml, like gecko) version/4.0 Safari/534.13
Since there is no "mobile" string, serve this user the desktop version (or a version customized for Android large-screen Touch devices ). the User-Agent tells us they're coming from a large-screen device, the xoom tablet.
On the other hand, this User-Agent:
Mozilla/5.0 (Linux; U; Android 2.2.1; en-US; Nexus One build/frg83) applewebkit/533.1 (khtml, like gecko) version/4.0 mobile safari/533.1
Contains "mobile" and "Android," so serve the web surfer on this Nexus One the mobile experience!
While you may still want to detect "android" in the User-Agent to implement Android-specific features, such as touch-screen optimizations, our main message is: shocould your mobile site depends on UA sniffing,
Please detect the strings "mobile" and "Android," rather than just "Android," in the User-Agent. This helps properly serve both your mobile and tablet visitors.
Note that some devices may be faulty and are not implemented in accordance with the above standards.
Link: http://googlewebmastercentral.blogspot.com/2011/03/mo-better-to-also-detect-mobile-user.html
Http://webcache.googleusercontent.com/search? Q = cache: 2hokprp-0fuj: Success