Plugin cant detect android mobile or tablet…

Home Forums Any Mobile Theme Switcher Plugin cant detect android mobile or tablet…

This topic contains 6 replies, has 2 voices, and was last updated by  wayne 2 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #640

    Gil

    Hi

    I am using this great plugin and everything works great except for one major issue which I can’t believe no one noticed!

    There is an option of Android theme detection but it’s not set to detect weather it’s an Android mobile (such as Galaxy) or Android tablet.

    When I set Android to switch to my mobile version it also does it for tablets and shows mobile version on tablet….

    any suggestion?

    Thanks

     

    #652

    Dinesh
    Keymaster

    Ya, we don’t have separate for Android tab yet.

    I am going to add this option in coming release. Thanks.

    #737

    Jeongsu Kim

    Hello.

    I added this feature. Actually, I don’t know it is OK or not but it is working for me.

    Anyway android tables that uses under Honeycomb is not detected yet.

    <code>

    diff –git a/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php b/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php
    index 5cde7ca..dd22df7 100644
    — a/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php
    +++ b/user/blog/wp-content/plugins/any-mobile-theme-switcher/any-mobile-theme-switcher.php
    @@ -33,8 +33,16 @@ $accept           = $_SERVER[‘HTTP_ACCEPT’]; // get the content accept value – t
    break; // break out and skip the rest if we’ve had a match on the iphone or ipod

    case (preg_match(‘/android/i’,$user_agent));  // we find android in the user agent
    –      $mobile_browser = get_option(‘android_theme’); // mobile browser is either true or false depending on the setting of android when calling the function
    –      $status = ‘Android’;
    +      if (preg_match(‘/mobile/i’,$user_agent))
    +      {
    +        $mobile_browser = get_option(‘android_theme’); // mobile browser is either true or false depending on the setting of android when calling the function
    +        $status = ‘Android’;
    +      }
    +      else
    +      {
    +        $mobile_browser = get_option(‘android_tablet_theme’); // mobile browser is either true or false depending on the setting of android when calling the function
    +        $status = ‘AndroidTablet’;
    +      }
    break; // break out and skip the rest if we’ve had a match on android

    case (preg_match(‘/opera mini/i’,$user_agent)); // we find opera mini in the user agent
    diff –git a/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php b/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php
    index 1dbdd80..2a336fd 100644
    — a/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php
    +++ b/user/blog/wp-content/plugins/any-mobile-theme-switcher/plugin_interface.php
    @@ -11,6 +11,7 @@ function register_mysettings_theme() {
    register_setting(‘am-settings-group’, ‘iphone_theme’);
    register_setting(‘am-settings-group’, ‘ipad_theme’);
    register_setting(‘am-settings-group’, ‘android_theme’);
    +    register_setting(‘am-settings-group’, ‘android_tablet_theme’);
    register_setting(‘am-settings-group’, ‘blackberry_theme’);
    register_setting(‘am-settings-group’, ‘windows_theme’);
    register_setting(‘am-settings-group’, ‘opera_theme’);
    @@ -26,6 +27,7 @@ function am_settings_page() {
    $iphoneTheme         = get_option(‘iphone_theme’);
    $ipadTheme            = get_option(‘ipad_theme’);
    $androidTheme        = get_option(‘android_theme’);
    +    $androidTabletTheme        = get_option(‘android_tablet_theme’);
    $blackberryTheme    = get_option(‘blackberry_theme’);
    $windowsTheme        = get_option(‘windows_theme’);
    $operaTheme            = get_option(‘opera_theme’);
    @@ -132,6 +134,24 @@ function am_settings_page() {
    </tr>

    +        <tr valign=”top”>
    +        <th scope=”row”>Android Tablet Theme</th>
    +        <td>
    +            <select name=”android_tablet_theme”>
    +     <?php
    +      foreach ($themeNames as $themeName) {
    +          if (($androidTabletTheme == $themeName) || (($androidTabletTheme == ”) && ($themeName == $defaultTheme))) {
    +              echo ‘<option value=”‘ . $themeName . ‘” selected=”selected”>’ . htmlspecialchars($themeName) . ‘</option>’;
    +          } else {
    +              echo'<option value=”‘ . $themeName . ‘”>’ . htmlspecialchars($themeName) . ‘</option>’;
    +          }
    +      }
    +     ?>
    +            </select>
    +        </td>
    +        </tr>
    +
    +
    <tr valign=”top”>
    <th scope=”row”>Blackberry Theme</th>
    <td>

    </code>

    #821

    Dinesh
    Keymaster

    @Jeongsu Kim : I check you code and its the right way to do this. However there are so many andriod devices in market which use urgent agent as mobile even they are a tab.

    If you could send me the user agent of Honeycomb. I could check it better to make it works.

    Thanks

    #878

    Dinesh
    Keymaster

    I have updated the latest release with andriod tab option. PLease update to the latest version.

    And let me know if you have any issues.

    #2959

    Jesse

    This still loads the wrong theme on android tablets. Not loading the theme I selected… Please help

    #3734

    wayne

    Hi, Great plugin however i am having the same issue with the incorrect themes loading.
    I have 2 themes. Theme 1 is designed for desktops and tablets and theme 2 for mobile.
    I have assigned theme 1 to android tablet and theme 2 to android mobile but it is still loading the mobile theme on tablet?

    I am all up to date on the plugin however am using the latest WP

    Thanks

    Wayne

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Plugin cant detect android mobile or tablet…’ is closed to new replies.