Reputation: 241
How can i put certain conditions depending upon the device OS version in a phonegap android application.Like I have tried this:-
deviceVersion = device.version;
if (deviceVersion > 2.3){....
} else {
......
}
But this doesn't works on real devices as the device version is like 4.0.2 etc.
Any Solution for this ?
Upvotes: 0
Views: 108
Reputation: 14315
Try this..
var ua = navigator.userAgent;
if( ua.indexOf("Android") >= 0 )
{
var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8));
if (androidversion < 2.3)
{
// do whatever
}
}
Detecting the OS version of iOS and Android in the browser
Upvotes: 1