0

as I am using some CSS styles in a mobile web application which are not working or are not being rendered correctly in Android API versions smaller 8 (Froyo), I am now trying to get the API Level (must be > 7) or Android version number (> 2.1) through the user agent string (I prefer backend detection [JSP] over JavaScript, but this shouldn't matter).

I'm currently checking if user agent (lower case) contains "iphone" OR (contains "android" AND "mobile" AND ??? <- version number)

Another possiblity would propably be to check against the WebKit build number.

Thank you for an answer.

dennis
  • 765
  • 1
  • 11
  • 25

2 Answers2

0

Finding out the Android OS version number might suffice in most cases: you can use either of the following two approaches:

  1. Version number: Get Android OS version from user-agent
  2. Exact device information: https://gist.github.com/2589680
Community
  • 1
  • 1
Suman
  • 9,221
  • 5
  • 49
  • 62
0

The user agent string from Android does contain the SDK version.

Check this link. http://www.gtrifonov.com/2011/04/15/google-android-user-agent-strings-2/

I have never seen that to contain a API level, so perhaps you have to manage with SDK version.

Kumar Bibek
  • 9,016
  • 2
  • 39
  • 68