Is there a way for an Android app to determine its target API level? (Particularly in the case of a JAR library, which cannot influence which apps it is embedded in, while app developers may not be able to change the code of the JAR.)
For a given context
, call:
context.getApplicationInfo().targetSdkVersion
Same for minSdkVersion
, which will give you the minimum SDK version.