Fixing advertised_device_os_version using patch file

Are you absolutely, positively sure that your question does not fit anywhere else?
ic10503
Posts: 7
Joined: Thu Feb 26, 2015 8:06 pm

Fixing advertised_device_os_version using patch file

Postby ic10503 » Tue Mar 17, 2015 5:16 pm

I am looking at advertised_device_os_version to find the OS version information.
For this Kindle fire tablet user agent string
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.153-debug_10033200) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true",

advertised_device_os_version is set to 10.6.3 though I am expecting 2.3 [though device_os_version is set to this value]. I want to fix this using the wurfl_patch.xml file which goes like this:

Code: Select all

<wurfl_patch>
<devices>
    <device user_agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.153-debug_10033200) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" fall_back="amazon_kindle_fire_ver1" id="amazon_kindle_fire_ver1_debug">
    	<group id="virtual">
            <capability name="controlcap_advertised_device_os_version" value="2.23"/>
        </group>
     </device>
</devices>
</wurfl_patch> 
But advertised_device_os_version still remains set to 10.6.3. I am not sure whether my id above is correct or not. Can you please tell me if my patch file is setting values correctly or the format is correct? Please also let me know if there is a better or recommended approach to this kind of problem.

Elliotfehr

Re: Fixing advertised_device_os_version using patch file

Postby Elliotfehr » Tue Mar 17, 2015 6:48 pm

Hello,

I have just tested this patch file and the format is correct. Keep in mind you will need to instruct the API to load the new patch file and the wurfl.xml/patch files will need to be reloaded after this change. Are you able to let me know which API you are testing this with?

Thank you,

Elliot

ic10503
Posts: 7
Joined: Thu Feb 26, 2015 8:06 pm

Re: Fixing advertised_device_os_version using patch file

Postby ic10503 » Tue Mar 17, 2015 7:01 pm

Hi Elliot, thanks for replying. I am using WURFL API version 1.5.1. I modified my patch file a bit but still the controlcap_advertised_device_os_version capability does not get set to my specified value.

Here is the patch file I am using:

Code: Select all

<wurfl_patch>
<devices>
    <device user_agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.153-debug_10033200) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" 
    fall_back="amazon_kindle_fire_ver1" id="amazon_kindle_fire_ver1_debug" actual_device_root="true" >
    	<group id="virtual">
            <capability name="controlcap_advertised_device_os_version" value="2.23"/>
        </group>
        
        <group id="product_info">
              <capability name="device_os_version" value="4.0"/>
        </group>   
     </device>
</devices>
</wurfl_patch>
With the above file, my device_os_version is being set to 4.0 but advertised_device_os_version is not set to 2.23[it remains set to 10.6.3]. I am wondering if it's possible to set a virtual capability using the wurfl patch file. I have never seen anybody setting a virtual capability anywhere on internet.

ic10503
Posts: 7
Joined: Thu Feb 26, 2015 8:06 pm

Re: Fixing advertised_device_os_version using patch file

Postby ic10503 » Tue Mar 17, 2015 7:21 pm

Looking at the code of WURFLPatchingManager class, it does not seem like virtual capabilities are set using the WURFL patch file. Is there any other suggested approach to fix this ?

I don't want to look at device_os_version instead of advertised_device_os_version because for Firefox user agent strings[example: "Mozilla/5.0 (Android; Mobile; rv:34.0) Gecko/34.0 Firefox/34.0"], device_os_versions are set to 2.2.

Elliotfehr

Re: Fixing advertised_device_os_version using patch file

Postby Elliotfehr » Tue Mar 17, 2015 8:12 pm

The controlcap_advertised_device_os_version is the correct capability to define in your patch file. I have been able to use your patch file in our Java API and PHP API to replicate the desired results. Here is a small code snippet as to how you could load the patch file in Java:

Code: Select all

// Set the path to the wurfl.xml
WURFLResource root = new XMLResource("/usr/share/wurfl/wurfl.xml");

// Define the desired patch files
WURFLResources patches = new WURFLResources();
WURFLResource patch = new XMLResource("/usr/share/wurfl/patch.xml");
patches.add(patch);

// Set the WURFL performance mode
GeneralWURFLEngine wurflEngine = new GeneralWURFLEngine(root,patches);
wurflEngine.setEngineTarget(EngineTarget.accuracy);
        
// Detect the device
Device device = wurflEngine.getDeviceForRequest("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.153-debug_10033200) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true");

// Get a capability
String advertised_device_os_version = device.getVirtualCapability("advertised_device_os_version");
        
System.out.println(advertised_device_os_version);

ic10503
Posts: 7
Joined: Thu Feb 26, 2015 8:06 pm

Re: Fixing advertised_device_os_version using patch file

Postby ic10503 » Wed Mar 18, 2015 4:55 pm

Thanks Elliot for clarification. I have another very related question, I want to patch similar useragents which only differ on the Silk version [Silk/*].

Code: Select all

<wurfl_patch>
<devices>
    <device user_agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" 
    fall_back="amazon_kindle_fire_ver1" id="amazon_kindle_fire_ver1_debug" actual_device_root="true" >
       <group id="virtual">
            <capability name="controlcap_advertised_device_os_version" value="2.23"/>
        </group>   
     </device>
</devices>
</wurfl_patch>
So, I am sort to trying to get this patch match for user agent string "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.13) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true" etc. But seems like it does not match them. Am I doing it right ?

Elliotfehr

Re: Fixing advertised_device_os_version using patch file

Postby Elliotfehr » Thu Mar 19, 2015 9:39 am

You are correctly adding the patch file, however you will need to add the exact User Agent that you are trying detect via a patch file.

Thank you,

Elliot


Who is online

Users browsing this forum: No registered users and 3 guests