class MobileESPConverted::UserAgentInfo

Constants

DEVICE_ANDROID
DEVICE_ARCHOS
DEVICE_BADA
DEVICE_BREW
DEVICE_B_B
DEVICE_B_B10
DEVICE_B_B_BOLD
DEVICE_B_B_BOLD_TOUCH
DEVICE_B_B_CURVE
DEVICE_B_B_CURVE_TOUCH
DEVICE_B_B_PLAYBOOK
DEVICE_B_B_STORM
DEVICE_B_B_TORCH
DEVICE_B_B_TOUR
DEVICE_DANGER
DEVICE_GOOGLE_T_V
DEVICE_HIPTOP
DEVICE_HTC_FLYER
DEVICE_IE_MOB
DEVICE_IPAD
DEVICE_IPHONE
DEVICE_IPOD
DEVICE_KINDLE
DEVICE_MAC_PPC
DEVICE_MEEGO
DEVICE_MIDP
DEVICE_NINTENDO
DEVICE_NINTENDO_DS
DEVICE_NUVIFONE
DEVICE_PALM
DEVICE_PDA
DEVICE_PLAYSTATION
DEVICE_PLAYSTATION_VITA
DEVICE_PPC
DEVICE_S60
DEVICE_S70
DEVICE_S80
DEVICE_S90
DEVICE_SYMBIAN
DEVICE_TABLET
DEVICE_TIZEN
DEVICE_WEB_O_S
DEVICE_WEB_O_SHP
DEVICE_WII
DEVICE_WINDOWS
DEVICE_WIN_MOB
DEVICE_WIN_PHONE7
DEVICE_WIN_PHONE8
DEVICE_XBOX
DIS_UPDATE
ENGINE_BLAZER
ENGINE_NETFRONT
ENGINE_OBIGO
ENGINE_OPEN_WEB
ENGINE_OPERA
ENGINE_PIE
ENGINE_SILK
ENGINE_TELECA_Q
ENGINE_UP_BROWSER
ENGINE_WEB_KIT
ENGINE_XIINO
LINUX
MAEMO
MANUERICSSON
MANU_HTC
MANU_SAMSUNG1
MANU_SONY
MANU_SONY_ERICSSON
MINI
MOBI
MOBILE
MYLOCOM2
QTEMBEDDED
SVC_DOCOMO
SVC_KDDI
SVC_VODAFONE
VNDWAP
VND_R_I_M
WML

Attributes

http_accept[R]
init_completed[R]
is_android[R]
is_android_phone[R]
is_iphone[R]
is_mobile_phone[R]
is_tier_generic_mobile[R]
is_tier_iphone[R]
is_tier_rich_css[R]
is_tier_tablet[R]
is_webkit[R]
user_agent[R]

Public Class Methods

new(user_agent, http_accept) click to toggle source

*

*

# File lib/mobileesp_converted/user_agent_info.rb, line 200
def initialize(user_agent, http_accept)
  if (user_agent != nil)
    @user_agent = user_agent.downcase
  end
  if (http_accept != nil)
    @http_accept = http_accept.downcase
  end


  init_device_scan()
end

Public Instance Methods

detect_amazon_silk() click to toggle source

*

  • Detects if the current Amazon device is using the Silk Browser.

  • Note: Typically used by the the Kindle Fire.

  • @return detection of an Amazon Kindle Fire in Silk mode.

# File lib/mobileesp_converted/user_agent_info.rb, line 845
def detect_amazon_silk()
  if (user_agent.include?(ENGINE_SILK))
    return true
  end
  return false
end
detect_android() click to toggle source

*

  • Detects any Android OS-based device: phone, tablet, and multi-media player.

  • Also detects Google TV.

  • @return detection of an Android device

# File lib/mobileesp_converted/user_agent_info.rb, line 388
def detect_android()
  if ((@init_completed == true) ||
      (@is_android == true))
    return @is_android
  end

  if ((user_agent.include?(DEVICE_ANDROID)) ||
      detect_google_t_v())
    return true
  end

  if (user_agent.include?(DEVICE_HTC_FLYER))
    return true
  end
  return false
end
detect_android_phone() click to toggle source

*

  • Detects if the current device is a (small-ish) Android OS-based device

  • used for calling and/or multi-media (like a Samsung Galaxy Player).

  • Google says these devices will have 'Android' AND 'mobile' in user agent.

  • Ignores tablets (Honeycomb and later).

  • @return detection of an Android phone

# File lib/mobileesp_converted/user_agent_info.rb, line 414
def detect_android_phone()
  if ((@init_completed == true) ||
      (@is_android_phone == true))
    return @is_android_phone
  end

  if (detect_android() && (user_agent.include?(MOBILE)))
    return true
  end

  if (detect_opera_android_phone())
    return true
  end

  if (user_agent.include?(DEVICE_HTC_FLYER))
    return true
  end
  return false
end
detect_android_tablet() click to toggle source

*

  • Detects if the current device is a (self-reported) Android tablet.

  • Google says these devices will have 'Android' and NOT 'mobile' in their user agent.

  • @return detection of an Android tablet

# File lib/mobileesp_converted/user_agent_info.rb, line 441
def detect_android_tablet()

  if (!detect_android())
    return false
  end


  if (detect_opera_mobile())
    return false
  end

  if (user_agent.include?(DEVICE_HTC_FLYER))
    return false
  end


  if ((user_agent.include?(MOBILE)))
    return false
  else
    return true
  end
end
detect_android_web_kit() click to toggle source

*

  • Detects if the current device is an Android OS-based device and

  • the browser is based on WebKit.

  • @return detection of an Android WebKit browser

# File lib/mobileesp_converted/user_agent_info.rb, line 471
def detect_android_web_kit()
  if (detect_android() && detect_webkit())
    return true
  end
  return false
end
detect_archos() click to toggle source

*

  • Detects if the current device is an Archos media player/Internet tablet.

  • @return detection of an Archos media player

# File lib/mobileesp_converted/user_agent_info.rb, line 952
def detect_archos()
  if (user_agent.include?(DEVICE_ARCHOS))
    return true
  end
  return false
end
detect_bada() click to toggle source

*

  • Detects a device running the Bada smartphone OS from Samsung.

  • @return detection of a Bada device

# File lib/mobileesp_converted/user_agent_info.rb, line 872
def detect_bada()
  if (user_agent.include?(DEVICE_BADA))
    return true
  end
  return false
end
detect_black_berry() click to toggle source

*

  • Detects if the current browser is any BlackBerry.

  • Includes BB10 OS, but excludes the PlayBook.

  • @return detection of Blackberry

# File lib/mobileesp_converted/user_agent_info.rb, line 584
def detect_black_berry()
  if (user_agent.include?(DEVICE_B_B) ||
      http_accept.include?(VND_R_I_M))
    return true
  end

  if (detect_black_berry10_phone())
    return true
  end

  return false
end
detect_black_berry10_phone() click to toggle source

*

  • Detects if the current browser is a BlackBerry 10 OS phone.

  • Excludes tablets.

  • @return detection of a Blackberry 10 device

# File lib/mobileesp_converted/user_agent_info.rb, line 604
def detect_black_berry10_phone()
  if (user_agent.include?(DEVICE_B_B10) &&
      user_agent.include?(MOBILE))
    return true
  end
  return false
end
detect_black_berry_high() click to toggle source

*

  • Detects if the current browser is a BlackBerry device AND

  • has a more capable recent browser. Excludes the Playbook.

  • Examples, Storm, Bold, Tour, Curve2

  • Excludes the new BlackBerry OS 6 and 7 browser!!

  • @return detection of a Blackberry device with a better browser

# File lib/mobileesp_converted/user_agent_info.rb, line 668
def detect_black_berry_high()

  if (detect_black_berry_web_kit())
    return false
  end
  if (detect_black_berry())
    if (detect_black_berry_touch() || user_agent.include?(DEVICE_B_B_BOLD) || user_agent.include?(DEVICE_B_B_TOUR) || user_agent.include?(DEVICE_B_B_CURVE))
      return true
    else
      return false
    end
  else
    return false
  end
end
detect_black_berry_low() click to toggle source

*

  • Detects if the current browser is a BlackBerry device AND

  • has an older, less capable browser.

  • Examples: Pearl, 8800, Curve1

  • @return detection of a Blackberry device with a poorer browser

# File lib/mobileesp_converted/user_agent_info.rb, line 692
def detect_black_berry_low()
  if (detect_black_berry())

    if (detect_black_berry_high() || detect_black_berry_web_kit())
      return false
    else
      return true
    end
  else
    return false
  end
end
detect_black_berry_tablet() click to toggle source

*

  • Detects if the current browser is on a BlackBerry tablet device.

  • Example: PlayBook

  • @return detection of a Blackberry Tablet

# File lib/mobileesp_converted/user_agent_info.rb, line 619
def detect_black_berry_tablet()
  if (user_agent.include?(DEVICE_B_B_PLAYBOOK))
    return true
  end
  return false
end
detect_black_berry_touch() click to toggle source

*

  • Detects if the current browser is a BlackBerry Touch

  • device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.

  • @return detection of a Blackberry touchscreen device

# File lib/mobileesp_converted/user_agent_info.rb, line 648
def detect_black_berry_touch()
  if (detect_black_berry() &&
      (user_agent.include?(DEVICE_B_B_STORM) ||
       user_agent.include?(DEVICE_B_B_TORCH) ||
       user_agent.include?(DEVICE_B_B_BOLD_TOUCH) ||
       user_agent.include?(DEVICE_B_B_CURVE_TOUCH)) )
    return true
  end
  return false
end
detect_black_berry_web_kit() click to toggle source

*

  • Detects if the current browser is a BlackBerry device AND uses a

  • WebKit-based browser. These are signatures for the new BlackBerry OS 6.

  • Examples: Torch. Includes the Playbook.

  • @return detection of a Blackberry device with WebKit browser

# File lib/mobileesp_converted/user_agent_info.rb, line 634
def detect_black_berry_web_kit()
  if (detect_black_berry() && detect_webkit())
    return true
  end
  return false
end
detect_brew_device() click to toggle source

*

  • Detects whether the device is a Brew-powered device.

  • @return detection of a Brew device

# File lib/mobileesp_converted/user_agent_info.rb, line 1033
def detect_brew_device()
  if (user_agent.include?(DEVICE_BREW))
    return true
  end
  return false
end
detect_danger_hiptop() click to toggle source

*

  • Detects the Danger Hiptop device.

  • @return detection of a Danger Hiptop

# File lib/mobileesp_converted/user_agent_info.rb, line 911
def detect_danger_hiptop()
  if (user_agent.include?(DEVICE_DANGER) || user_agent.include?(DEVICE_HIPTOP))
    return true
  end
  return false
end
detect_game_console() click to toggle source

*

  • Detects if the current device is an Internet-capable game console.

  • Includes many handheld consoles.

  • @return detection of any Game Console

# File lib/mobileesp_converted/user_agent_info.rb, line 966
def detect_game_console()
  if (detect_sony_playstation() || detect_nintendo() || detect_xbox())
    return true
  end
  return false
end
detect_gaming_handheld() click to toggle source

*

  • Detects if the current device is a handheld gaming device with

  • a touchscreen and modern iPhone-class browser. Includes the Playstation Vita.

  • @return detection of a handheld gaming device

# File lib/mobileesp_converted/user_agent_info.rb, line 993
def detect_gaming_handheld()
  if ((user_agent.include?(DEVICE_PLAYSTATION)) &&
      (user_agent.include?(DEVICE_PLAYSTATION_VITA)))
    return true
  end
  return false
end
detect_garmin_nuvifone() click to toggle source

*

  • Detects if the current browser is a

  • Garmin Nuvifone.

  • @return detection of a Garmin Nuvifone

# File lib/mobileesp_converted/user_agent_info.rb, line 859
def detect_garmin_nuvifone()
  if (user_agent.include?(DEVICE_NUVIFONE))
    return true
  end
  return false
end
detect_google_t_v() click to toggle source

*

  • Detects if the current device is a GoogleTV.

  • @return detection of GoogleTV

# File lib/mobileesp_converted/user_agent_info.rb, line 484
def detect_google_t_v()
  if (user_agent.include?(DEVICE_GOOGLE_T_V))
    return true
  end
  return false
end
detect_ios() click to toggle source

*

  • Detects any iOS device: iPhone, iPod Touch, iPad.

  • @return detection of an Apple iOS device

# File lib/mobileesp_converted/user_agent_info.rb, line 373
def detect_ios()
  if (detect_iphone_or_ipod() || detect_ipad())
    return true
  end
  return false
end
detect_ipad() click to toggle source

*

  • Detects if the current device is an iPad tablet.

  • @return detection of an iPad

# File lib/mobileesp_converted/user_agent_info.rb, line 346
def detect_ipad()
  if (user_agent.include?(DEVICE_IPAD) && detect_webkit())
    return true
  end
  return false
end
detect_iphone() click to toggle source

*

  • Detects if the current device is an iPhone.

  • @return detection of an iPhone

# File lib/mobileesp_converted/user_agent_info.rb, line 312
def detect_iphone()
  if ((@init_completed == true) ||
      (@is_iphone == true))
    return @is_iphone
  end


  if (user_agent.include?(DEVICE_IPHONE) &&
      !detect_ipad() &&
      !detect_ipod())
    return true
  end
  return false
end
detect_iphone_or_ipod() click to toggle source

*

  • Detects if the current device is an iPhone or iPod Touch.

  • @return detection of an iPhone or iPod Touch

# File lib/mobileesp_converted/user_agent_info.rb, line 359
def detect_iphone_or_ipod()

  if (detect_iphone() || user_agent.include?(DEVICE_IPOD))
    return true
  end
  return false
end
detect_ipod() click to toggle source

*

  • Detects if the current device is an iPod Touch.

  • @return detection of an iPod Touch

# File lib/mobileesp_converted/user_agent_info.rb, line 333
def detect_ipod()
  if (user_agent.include?(DEVICE_IPOD))
    return true
  end
  return false
end
detect_kindle() click to toggle source

*

  • Detects if the current device is an Amazon Kindle (eInk devices only).

  • Note: For the Kindle Fire, use the normal Android methods.

  • @return detection of a Kindle

# File lib/mobileesp_converted/user_agent_info.rb, line 830
def detect_kindle()
  if (user_agent.include?(DEVICE_KINDLE) &&
      !detect_android())
    return true
  end
  return false
end
detect_maemo_tablet() click to toggle source

*

  • Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.

  • @return detection of a Maemo OS tablet

# File lib/mobileesp_converted/user_agent_info.rb, line 937
def detect_maemo_tablet()
  if (user_agent.include?(MAEMO))
    return true
  elsif (user_agent.include?(LINUX) && user_agent.include?(DEVICE_TABLET) && !detect_web_o_s_tablet() && !detect_android())
    return true
  end
  return false
end
detect_meego() click to toggle source

*

  • Detects a device running the Meego OS.

  • @return detection of a Meego device

# File lib/mobileesp_converted/user_agent_info.rb, line 898
def detect_meego()
  if (user_agent.include?(DEVICE_MEEGO))
    return true
  end
  return false
end
detect_midp_capable() click to toggle source

*

  • Detects if the current device supports MIDP, a mobile Java technology.

  • @return detection of a MIDP mobile Java-capable device

# File lib/mobileesp_converted/user_agent_info.rb, line 1059
def detect_midp_capable()
  if (user_agent.include?(DEVICE_MIDP) || http_accept.include?(DEVICE_MIDP))
    return true
  end
  return false
end
detect_mobile_long() click to toggle source

*

  • The longer and more thorough way to detect for a mobile device.

  • Will probably detect most feature phones,

  • smartphone-class devices, Internet Tablets,

  • Internet-enabled game consoles, etc.

  • This ought to catch a lot of the more obscure and older devices, also –

  • but no promises on thoroughness!

  • @return detection of any mobile device using the more thorough method

# File lib/mobileesp_converted/user_agent_info.rb, line 1143
def detect_mobile_long()
  if (detect_mobile_quick() || detect_game_console() || detect_sony_mylo())
    return true
  end


  if (user_agent.include?(UPLINK))
    return true
  end
  if (user_agent.include?(MANU_SONY_ERICSSON))
    return true
  end
  if (user_agent.include?(MANUERICSSON))
    return true
  end
  if (user_agent.include?(MANU_SAMSUNG1))
    return true
  end

  if (user_agent.include?(SVC_DOCOMO))
    return true
  end
  if (user_agent.include?(SVC_KDDI))
    return true
  end
  if (user_agent.include?(SVC_VODAFONE))
    return true
  end

  return false
end
detect_mobile_quick() click to toggle source

*

  • Detects if the current device is a mobile device.

  • This method catches most of the popular modern devices.

  • Excludes Apple iPads and other modern tablets.

  • @return detection of any mobile device using the quicker method

# File lib/mobileesp_converted/user_agent_info.rb, line 1087
def detect_mobile_quick()

  if (detect_tier_tablet())
    return false
  end

  if ((init_completed == true) ||
      (is_mobile_phone == true))
    return is_mobile_phone
  end


  if (detect_smartphone())
    return true
  end

  if (detect_wap_wml() || detect_brew_device() || detect_opera_mobile())
    return true
  end

  if ((user_agent.include?(ENGINE_OBIGO)) || (user_agent.include?(ENGINE_NETFRONT)) || (user_agent.include?(ENGINE_UP_BROWSER)) || (user_agent.include?(ENGINE_OPEN_WEB)))
    return true
  end

  if (detect_danger_hiptop() || detect_midp_capable() || detect_maemo_tablet() || detect_archos())
    return true
  end

  if ((user_agent.include?(DEVICE_PDA)) &&
      (!user_agent.include?(DIS_UPDATE)))
    return true
  end

  if (user_agent.include?(MOBILE))
    return true
  end


  if (detect_kindle() || detect_amazon_silk())
    return true
  end

  return false
end
detect_nintendo() click to toggle source

*

  • Detects if the current device is a Nintendo game device.

  • @return detection of Nintendo

# File lib/mobileesp_converted/user_agent_info.rb, line 1007
def detect_nintendo()
  if (user_agent.include?(DEVICE_NINTENDO) || user_agent.include?(DEVICE_WII) || user_agent.include?(DEVICE_NINTENDO_DS))
    return true
  end
  return false
end
detect_opera_android_phone() click to toggle source

*

  • Detects Opera Mobile on an Android phone.

  • @return detection of an Opera browser on an Android phone

# File lib/mobileesp_converted/user_agent_info.rb, line 803
def detect_opera_android_phone()
  if (user_agent.include?(ENGINE_OPERA) && (user_agent.include?(DEVICE_ANDROID) && user_agent.include?(MOBI)))
    return true
  end
  return false
end
detect_opera_android_tablet() click to toggle source

*

  • Detects Opera Mobile on an Android tablet.

  • @return detection of an Opera browser on an Android tablet

# File lib/mobileesp_converted/user_agent_info.rb, line 816
def detect_opera_android_tablet()
  if (user_agent.include?(ENGINE_OPERA) && (user_agent.include?(DEVICE_ANDROID) && user_agent.include?(DEVICE_TABLET)))
    return true
  end
  return false
end
detect_opera_mobile() click to toggle source

*

  • Detects Opera Mobile or Opera Mini.

  • @return detection of an Opera browser for a mobile device

# File lib/mobileesp_converted/user_agent_info.rb, line 790
def detect_opera_mobile()
  if (user_agent.include?(ENGINE_OPERA) && (user_agent.include?(MINI) || user_agent.include?(MOBI)))
    return true
  end
  return false
end
detect_palm_o_s() click to toggle source

*

  • Detects if the current browser is on a PalmOS device.

  • @return detection of a PalmOS device

# File lib/mobileesp_converted/user_agent_info.rb, line 743
def detect_palm_o_s()

  if (detect_palm_web_o_s())
    return false
  end


  if (user_agent.include?(DEVICE_PALM) || user_agent.include?(ENGINE_BLAZER) || user_agent.include?(ENGINE_XIINO))
    return true
  end
  return false
end
detect_palm_web_o_s() click to toggle source

*

  • Detects if the current browser is on a Palm device

  • running the new WebOS.

  • @return detection of a Palm WebOS device

# File lib/mobileesp_converted/user_agent_info.rb, line 763
def detect_palm_web_o_s()
  if (user_agent.include?(DEVICE_WEB_O_S))
    return true
  end
  return false
end
detect_s60_oss_browser() click to toggle source

*

  • Detects if the current browser is the Symbian S60 Open Source Browser.

  • @return detection of Symbian S60 Browser

# File lib/mobileesp_converted/user_agent_info.rb, line 712
def detect_s60_oss_browser()

  if (detect_webkit() && (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60)))
    return true
  end
  return false
end
detect_smartphone() click to toggle source

*

  • Check to see whether the device is any device

  • in the 'smartphone' category.

  • @return detection of a general smartphone device

# File lib/mobileesp_converted/user_agent_info.rb, line 1074
def detect_smartphone()

  return (detect_tier_iphone() || detect_s60_oss_browser() || detect_symbian_o_s() || detect_windows_mobile() || detect_black_berry() || detect_palm_o_s())
end
detect_sony_mylo() click to toggle source

*

  • Detects if the current browser is a Sony Mylo device.

  • @return detection of a Sony Mylo device

# File lib/mobileesp_converted/user_agent_info.rb, line 924
def detect_sony_mylo()
  if (user_agent.include?(MANU_SONY) && (user_agent.include?(QTEMBEDDED) || user_agent.include?(MYLOCOM2)))
    return true
  end
  return false
end
detect_sony_playstation() click to toggle source

*

  • Detects if the current device is a Sony Playstation.

  • @return detection of Sony Playstation

# File lib/mobileesp_converted/user_agent_info.rb, line 979
def detect_sony_playstation()
  if (user_agent.include?(DEVICE_PLAYSTATION))
    return true
  end
  return false
end
detect_symbian_o_s() click to toggle source

* *

  • Detects if the current device is any Symbian OS-based device,

  • including older S60, Series 70, Series 80, Series 90, and UIQ,

  • or other browsers running on these devices.

  • @return detection of SymbianOS

# File lib/mobileesp_converted/user_agent_info.rb, line 729
def detect_symbian_o_s()
  if (user_agent.include?(DEVICE_SYMBIAN) || user_agent.include?(DEVICE_S60) || user_agent.include?(DEVICE_S70) || user_agent.include?(DEVICE_S80) || user_agent.include?(DEVICE_S90))
    return true
  end
  return false
end
detect_tier_iphone() click to toggle source

*

  • The quick way to detect for a tier of devices.

  • This method detects for devices which can

  • display iPhone-optimized web content.

  • Includes iPhone, iPod Touch, Android, Windows Phone 7 and 8, BB10, WebOS, Playstation Vita, etc.

  • @return detection of any device in the iPhone/Android/Windows Phone/BlackBerry/WebOS Tier

# File lib/mobileesp_converted/user_agent_info.rb, line 1206
def detect_tier_iphone()
  if ((@init_completed == true) ||
      (@is_tier_iphone == true))
    return @is_tier_iphone
  end

  if (detect_iphone_or_ipod() || detect_android_phone() || detect_windows_phone() || detect_black_berry10_phone() || (detect_black_berry_web_kit() && detect_black_berry_touch()) || detect_palm_web_o_s() || detect_bada() || detect_tizen() || detect_gaming_handheld())
    return true
  end
  return false
end
detect_tier_other_phones() click to toggle source

*

  • The quick way to detect for a tier of devices.

  • This method detects for all other types of phones,

  • but excludes the iPhone and RichCSS Tier devices.

  • @return detection of a mobile device in the less capable tier

# File lib/mobileesp_converted/user_agent_info.rb, line 1259
def detect_tier_other_phones()
  if ((@init_completed == true) ||
      (@is_tier_generic_mobile == true))
    return @is_tier_generic_mobile
  end


  if (detect_mobile_long() && !detect_tier_iphone() && !detect_tier_rich_css())
    return true
  end

  return false
end
detect_tier_rich_css() click to toggle source

*

  • The quick way to detect for a tier of devices.

  • This method detects for devices which are likely to be capable

  • of viewing CSS content optimized for the iPhone,

  • but may not necessarily support JavaScript.

  • Excludes all iPhone Tier devices.

  • @return detection of any device in the 'Rich CSS' Tier

# File lib/mobileesp_converted/user_agent_info.rb, line 1228
def detect_tier_rich_css()
  if ((@init_completed == true) ||
      (@is_tier_rich_css == true))
    return @is_tier_rich_css
  end

  result = false


  if (detect_mobile_quick())


    if (!detect_tier_iphone() && !detect_kindle())


      if (detect_webkit() || detect_s60_oss_browser() || detect_black_berry_high() || detect_windows_mobile() || user_agent.include?(ENGINE_TELECA_Q))
        result= true
      end
    end
  end
  return result
end
detect_tier_tablet() click to toggle source

*

  • The quick way to detect for a tier of devices.

  • This method detects for the new generation of

  • HTML 5 capable, larger screen tablets.

  • Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc.

  • @return detection of any device in the Tablet Tier

# File lib/mobileesp_converted/user_agent_info.rb, line 1185
def detect_tier_tablet()
  if ((@init_completed == true) ||
      (@is_tier_tablet == true))
    return @is_tier_tablet
  end

  if (detect_ipad() || detect_android_tablet() || detect_black_berry_tablet() || detect_web_o_s_tablet())
    return true
  end
  return false
end
detect_tizen() click to toggle source

*

  • Detects a device running the Tizen smartphone OS.

  • @return detection of a Tizen device

# File lib/mobileesp_converted/user_agent_info.rb, line 885
def detect_tizen()
  if (user_agent.include?(DEVICE_TIZEN))
    return true
  end
  return false
end
detect_wap_wml() click to toggle source

*

  • Detects whether the device supports WAP or WML.

  • @return detection of a WAP- or WML-capable device

# File lib/mobileesp_converted/user_agent_info.rb, line 1046
def detect_wap_wml()
  if (http_accept.include?(VNDWAP) || http_accept.include?(WML))
    return true
  end
  return false
end
detect_web_o_s_tablet() click to toggle source

*

  • Detects if the current browser is on an HP tablet running WebOS.

  • @return detection of an HP WebOS tablet

# File lib/mobileesp_converted/user_agent_info.rb, line 776
def detect_web_o_s_tablet()
  if (user_agent.include?(DEVICE_WEB_O_SHP) &&
      user_agent.include?(DEVICE_TABLET))
    return true
  end
  return false
end
detect_webkit() click to toggle source

*

  • Detects if the current browser is based on WebKit.

  • @return detection of a WebKit browser

# File lib/mobileesp_converted/user_agent_info.rb, line 497
def detect_webkit()
  if ((@init_completed == true) ||
      (@is_webkit == true))
    return @is_webkit
  end

  if (user_agent.include?(ENGINE_WEB_KIT))
    return true
  end
  return false
end
detect_windows_mobile() click to toggle source

*

  • Detects if the current browser is a Windows Mobile device.

  • Excludes Windows Phone 7.x and 8 devices.

  • Focuses on Windows Mobile 6.xx and earlier.

  • @return detection of Windows Mobile

# File lib/mobileesp_converted/user_agent_info.rb, line 557
def detect_windows_mobile()
  if (detect_windows_phone())
    return false
  end


  if (user_agent.include?(DEVICE_WIN_MOB) || user_agent.include?(DEVICE_WIN_MOB) || user_agent.include?(DEVICE_IE_MOB) || user_agent.include?(ENGINE_PIE) || (user_agent.include?(MANU_HTC) && user_agent.include?(DEVICE_WINDOWS)) || (detect_wap_wml() && user_agent.include?(DEVICE_WINDOWS)))
    return true
  end


  if (user_agent.include?(DEVICE_PPC) &&
      !(user_agent.include?(DEVICE_MAC_PPC)))
    return true
  end

  return false
end
detect_windows_phone() click to toggle source

*

  • Detects if the current browser is EITHER a Windows Phone 7.x OR 8 device

  • @return detection of Windows Phone 7.x OR 8

# File lib/mobileesp_converted/user_agent_info.rb, line 516
def detect_windows_phone()
  if (detect_windows_phone7() || detect_windows_phone8())
    return true
  end
  return false
end
detect_windows_phone7() click to toggle source

*

  • Detects a Windows Phone 7.x device (in mobile browsing mode).

  • @return detection of Windows Phone 7

# File lib/mobileesp_converted/user_agent_info.rb, line 529
def detect_windows_phone7()
  if (user_agent.include?(DEVICE_WIN_PHONE7))
    return true
  end
  return false
end
detect_windows_phone8() click to toggle source

*

  • Detects a Windows Phone 8 device (in mobile browsing mode).

  • @return detection of Windows Phone 8

# File lib/mobileesp_converted/user_agent_info.rb, line 542
def detect_windows_phone8()
  if (user_agent.include?(DEVICE_WIN_PHONE8))
    return true
  end
  return false
end
detect_xbox() click to toggle source

*

  • Detects if the current device is a Microsoft Xbox.

  • @return detection of Xbox

# File lib/mobileesp_converted/user_agent_info.rb, line 1020
def detect_xbox()
  if (user_agent.include?(DEVICE_XBOX))
    return true
  end
  return false
end
get_http_accept() click to toggle source

*

# File lib/mobileesp_converted/user_agent_info.rb, line 228
def get_http_accept()
  return http_accept
end
get_is_iphone() click to toggle source

*

  • Return whether the device is an Iphone or iPod Touch

  • @return #is_iphone

# File lib/mobileesp_converted/user_agent_info.rb, line 238
def get_is_iphone()
  return is_iphone
end
get_is_tier_generic_mobile() click to toggle source

*

# File lib/mobileesp_converted/user_agent_info.rb, line 278
def get_is_tier_generic_mobile()
  return is_tier_generic_mobile
end
get_is_tier_iphone() click to toggle source

*

# File lib/mobileesp_converted/user_agent_info.rb, line 258
def get_is_tier_iphone()
  return is_tier_iphone
end
get_is_tier_rich_css() click to toggle source

*

  • Return whether the device is in the 'Rich CSS' tier of mobile devices.

  • @return #is_tier_rich_css

# File lib/mobileesp_converted/user_agent_info.rb, line 268
def get_is_tier_rich_css()
  return is_tier_rich_css
end
get_is_tier_tablet() click to toggle source

*

# File lib/mobileesp_converted/user_agent_info.rb, line 248
def get_is_tier_tablet()
  return is_tier_tablet
end
get_user_agent() click to toggle source

*

  • Return the lower case HTTP_USER_AGENT

  • @return #user_agent

# File lib/mobileesp_converted/user_agent_info.rb, line 218
def get_user_agent()
  return user_agent
end
init_device_scan() click to toggle source

*

  • Initialize Key Stored Values.

# File lib/mobileesp_converted/user_agent_info.rb, line 287
def init_device_scan()

  @is_webkit        = detect_webkit()
  @is_iphone        = detect_iphone()
  @is_android       = detect_android()
  @is_android_phone = detect_android_phone()


  @is_mobile_phone = detect_mobile_quick()
  @is_tier_tablet  = detect_tier_tablet()
  @is_tier_iphone  = detect_tier_iphone()


  @is_tier_rich_css       = detect_tier_rich_css()
  @is_tier_generic_mobile = detect_tier_other_phones()

  @init_completed = true
end