【问题标题】:Detecting mobile phone with wurfl or mobiledetect.net not working on Galaxy S3使用 wurfl 或 mobiledetect.net 检测手机无法在 Galaxy S3 上运行
【发布时间】:2014-01-24 03:52:38
【问题描述】:

我已经下载了 wurfl api 和 mobiledetect.net 并使用我的三星 Galaxy S3 (GT-19300) 对其进行了测试。

我很惊讶在没有这些脚本的情况下没有检测到这款智能手机...... 肯定有什么问题……

脚本 (http://www.gondwanastudio.com/xJava/WURFL/examples/demo/index.php) 为 Galaxy S3 返回以下 UA...(用户代理:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/ 534.24)并告诉“ 这是一个桌面网络浏览器”。

我对来自 mobiledetect.net 的脚本 (http://www.gondwanastudio.com/xJava/test.php) 有同样的问题。

include_once './inc/wurfl_config_standard.php';

$wurflInfo = $wurflManager->getWURFLInfo();

$requestingDevice = $wurflManager->getDeviceForUserAgent($_GET['ua']);

if ($requestingDevice->getCapability('is_tablet') == 'true') {
   echo "Tablet";
}

$is_wireless = ($requestingDevice->getCapability('is_wireless_device') == 'true');
$is_smarttv = ($requestingDevice->getCapability('is_smarttv') == 'true');
$is_tablet = ($requestingDevice->getCapability('is_tablet') == 'true');
$is_phone = ($requestingDevice->getCapability('can_assign_phone_number') == 'true');

if (!$is_wireless) {
 if ($is_smarttv) {
  echo "This is a Smart TV";
 } else {
  echo "This is a Desktop Web Browser";
 }
} else {
 if ($is_tablet) {
  echo "This is a Tablet";
 } else if ($is_phone) {
  echo "This is a Mobile Phone";
 } else {
  echo "This is a Mobile Device";
 }
}

【问题讨论】:

    标签: php android mobile


    【解决方案1】:

    我认为问题在于您的 UA。您是否偶然在桌面模式下使用手机?现在它看起来像是将自己标识为台式机而不是移动设备,这就解释了为什么它没有被检测到。你的用户代理应该看起来更像:

    Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; GT-I9300 Build/IMM76K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

    如果您使用 ScientiaMobile 网站 (http://tools.scientiamobile.com) 上的 WURFL 工具进行检查,它应该是 Galaxy S3。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-09
      • 2013-08-03
      • 2015-03-19
      相关资源
      最近更新 更多