Ibm mobilefirst Worklight运行时外观-getSkinName工作不正常

Ibm mobilefirst Worklight运行时外观-getSkinName工作不正常,ibm-mobilefirst,worklight-runtime,worklight-skins,Ibm Mobilefirst,Worklight Runtime,Worklight Skins,我正在通过引用链接“”为Android设备的Worklight运行时外观创建一个示例。我已经更改了JS、CSS和HTML,以便在手机/平板电脑上应用皮肤,并且通过Worklight Preview对其进行了测试 但当我试图在实际设备中运行相同的代码时,我并没有得到预期的正确输出。原因是skinLoader.js中的“getSkinName()”功能未返回有效结果。 我尝试使用以下代码来检测设备是移动设备还是平板电脑,但这两个函数都给出了无效的输出 使用UserAgent://检测设备始终返回“a

我正在通过引用链接“”为Android设备的Worklight运行时外观创建一个示例。我已经更改了JS、CSS和HTML,以便在手机/平板电脑上应用皮肤,并且通过Worklight Preview对其进行了测试

但当我试图在实际设备中运行相同的代码时,我并没有得到预期的正确输出。原因是skinLoader.js中的“getSkinName()”功能未返回有效结果。 我尝试使用以下代码来检测设备是移动设备还是平板电脑,但这两个函数都给出了无效的输出

使用UserAgent://检测设备始终返回“android.phone”外观

function getSkinName() { 
        var userAgent = navigator.userAgent; 
        var skinName = "default"; 
        alert(userAgent); 
        //android tablet 
        if(userAgent.toLowerCase().indexOf("android") != -1 && 
            userAgent.toLowerCase().indexOf("mobile") == -1){ 
            skinName = "default"; 
            alert("tablet!"); 
        } 
        //android phone 
        else if(userAgent.toLowerCase().indexOf("android") != -1 && 
            userAgent.toLowerCase().indexOf("mobile") != -1){ 
            skinName = "android.phone"; 
            alert("phone!"); 
        } 

        return skinName; 
} 
使用设备的宽度检测设备://在整个方向上工作不正常

 function getSkinName() { 
        var skinName = "default"; 
        var hres = screen.width || window.innerWidth || 320; 
        var ratio = window.devicePixelRatio || 1; 
        if (ratio == 0) { 
               ratio = 1; 
        } 
        var virtWidth = hres / ratio; 
        if (virtWidth >= 640) { 
              skinName = "android.tablet"; 
        } 
    return skinName; 
 } 

请分享有关更正getSkinName()以实现正常功能的想法

您所经历的可能与此问题中提到的缺陷有关:

上述缺陷的修复程序可在Worklight 6.1.0.1的最新iFix版本中获得。

如果您是IBM客户或业务合作伙伴,您可以从IBM Fix Central(或通过PMR支持请求)获得此信息。

请验证您没有遇到此问题:您是否检查了上述内容?Worklight团队是否对Idan提出的问题作出了任何回应?(我是该团队的一员),是,此缺陷在Worklight 6.1.0.1的最新iFix中得到解决;你能确认这就是你正在经历的吗?也就是说,在您第二次加载应用程序后,它是否按预期工作?