Mobile Client Detection Plugin
[resolved] Fix: Android 4.0 phones detected as tablets (8 posts)

  1. LawnGnome
    Posted 4 years ago #

    All Android 4.0 devices are currently detected as tablets in MCD 0.9.0. The following (admittedly lightly tested) patch seems to fix this for me, both in the stock browser and Chrome:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Please let me know if you'd prefer to get the patch in another format.


  2. LawnGnome
    Posted 4 years ago #

    By which I meant http://pastebin.com/4rurT079, obviously.

  3. ransom1337
    Posted 3 years ago #

    Hi LawnGnome,

    Thanks for the patch. Being a PHP novice, I can't quite see where to paste your fix.

    I'm assuming it'll need to overwrite some of the code in mobile_client_detection.php, but I'm too worried about breaking it to overwrite any of the code. Could you tell me whereabouts it needs placing, please?


  4. ransom1337
    Posted 3 years ago #

    Does anyone have any help for this, please? :)

  5. syslogic
    Plugin Author

    Posted 3 years ago #

    great patch - how about droid tablets then? :)

    there is no way to measure the screen resolution with PHP.

    just use the other mode + JavaScript to see of it's a phone or tablet.

  6. syslogic
    Plugin Author

    Posted 3 years ago #

    I won't apply that patch, because it's not better in any way.
    Why should I fix one thing that will break another more likely thing?
    that's ridiculous. JB/ICS is per default a tablet built and rarely available on phones.

    Please just use JavaScript for detection of the screen resolution. Way to much processing for serving pages in real-time... sure i could preg_match for any f* device - but I just don't care.

    This plugin is just a proof of concept how to hook into the template engine properly.

  7. syslogic
    Plugin Author

    Posted 3 years ago #

    Sure it's a little generalized to say Android 4 is a tablet -
    but in 80% of the cases this might be a hit - the other 20% are rather a minority :)

    This is a theme developer tool, for more precise detection one should use a custom browsecap.ini ... or switch mobile clients by .htaccess already.

    By JS one can easily calculate available screen an it's aspect ratio.

    There's not too many plugins around capable of pushing content through a few different themes - at the same time ... which is the main application.

    Besides a better patch might be to change the regex to include the required 1 device (that pattern just matches my devices, feel free to modify it according to your environment).

  8. syslogic
    Plugin Author

    Posted 3 years ago #

    Probably it's even crap to differ between tablet and phone on the server-side - since once it's clear that it's rather a touch-device,
    one can load some JS framework to handle it. no matter if phone or tablet.
    just for example (very outdated version of jQuery mobile, but it can at least list the posts): http://mobile.codefx.biz - quite the same on phone and tablet (even if the content isn't too readable, of course)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Mobile Client Detection Plugin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic