Getting WURFL match status (exact/recovery)

Vringo
Posts: 4
Joined: Thu Nov 17, 2011 7:50 am

Getting WURFL match status (exact/recovery)

Postby Vringo » Thu Nov 17, 2011 7:59 am

When I call getDeviceForRequest, how can I know if the result is a conclusive match, or "guess"?
(I need to log this status in order be able to better analyze bugs in our system, and to manage our patches).

Thanks,
Hagai

Vringo
Posts: 4
Joined: Thu Nov 17, 2011 7:50 am

Re: Getting WURFL match status (exact/recovery)

Postby Vringo » Thu Nov 17, 2011 9:07 am

In the meanwhile I used this:

Code: Select all

		if (givenUA.equals(matchedUA)) {
			log.debug("WURFL found exact match for: " + givenUA);
		}
		else {
			int levenshteinDistance = StringUtils.getLevenshteinDistance(givenUA, matchedUA);
			boolean isPrefix = givenUA.startsWith(matchedUA);
			log.debug(String.format("WURFL found approximate match for: %s, found: %s, isPrefix: %b, levenshteinDistance: %d", 
					givenUA, matchedUA, isPrefix, levenshteinDistance) );
		}

luca.passani
Posts: 65
Joined: Thu May 19, 2011 2:49 pm

Re: Getting WURFL match status (exact/recovery)

Postby luca.passani » Thu Nov 17, 2011 9:11 am

Hi there.

Actually there is a simple trick that you can use. If the ID of the matched device contains the "generic" string, it means that the match happened through a recovery strategy.

Please let me know if this helps

Luca

Vringo
Posts: 4
Joined: Thu Nov 17, 2011 7:50 am

Re: Getting WURFL match status (exact/recovery)

Postby Vringo » Thu Nov 17, 2011 10:19 am

So if I understand correctly:
If the detected device UA equals the given UA then we can also assume the device id will not contain "generic".
It's possible to get a *"conclusive"* match of a given UA with a non-equal device UA, and in that case the device id will also not contain "generic".
The device ID contains "generic" if and only if a "recovery strategy" was used.

Code: Select all

if (givenUA.equals(matchedUA)) {
	// conclusive - exact (maybe no need to check this because "generic" is the only needed test???)
}
else if (!wurflDevice.getId().contains("generic")) {
	// conclusive - approx
}
else {
	// recovered
}

luca.passani
Posts: 65
Joined: Thu May 19, 2011 2:49 pm

Re: Getting WURFL match status (exact/recovery)

Postby luca.passani » Thu Nov 17, 2011 10:52 am

if I understand what you are asking correctly, the answer is that comparing the UA string in WURFL to the UA you got from the HTTP reuqest is not very significant, because the API applies all kinds of normalization and cleaning logic to identify a device no matter what the language locale and minor firmware variations are. So, the UAs may not match exactly, but still it was the conclusive heuristic that did the job of finding a match.

And yes, if a device ID contains "generic", it means that the match was obtained through a 'recovery heuristic'.

If you find an instance where this is not the case, please let us know because we would treat that as a bug.

One advantage of this approach is that you can easily analyse your logs offline (assuming you log the WURFL ID). Just grep for "generic"

Thanks

Luca

Vringo
Posts: 4
Joined: Thu Nov 17, 2011 7:50 am

Re: Getting WURFL match status (exact/recovery)

Postby Vringo » Sun Nov 20, 2011 2:35 am

Thanks!

luca.passani
Posts: 65
Joined: Thu May 19, 2011 2:49 pm

Re: Getting WURFL match status (exact/recovery)

Postby luca.passani » Sun Nov 20, 2011 8:51 am

This post actually inspired our Java engineer to a simple but nice addition to our API. Stay tuned.

Luca


Who is online

Users browsing this forum: No registered users and 16 guests