I think iOS does this automatically, not sure about another OS. But if you just test devices by their name using simple Javascript / jQuery, would that not be enough?
Something like that:
$.browser.device = (/android|webos|iphone|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
source
share