WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. LawnGnome
    Member
    Posted 2 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.

    http://wordpress.org/extend/plugins/mobile-client-detection-plugin/

  2. LawnGnome
    Member
    Posted 2 years ago #

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

  3. ransom1337
    Member
    Posted 1 year 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?

    Thanks.

  4. ransom1337
    Member
    Posted 1 year ago #

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

  5. syslogic
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year 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

About this Topic