Java Code Examples for com.android.sdklib.AndroidVersion#getFeatureLevel()
The following examples show how to use
com.android.sdklib.AndroidVersion#getFeatureLevel() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
protected int getMinSdk(Context context) { if (mMinApi == -1) { AndroidVersion minSdkVersion = context.getMainProject().getMinSdkVersion(); mMinApi = minSdkVersion.getFeatureLevel(); } return mMinApi; }
Example 2
Source File: PermissionRequirement.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * Returns false if this permission does not apply given the specified minimum and target * sdk versions * * @param available the permission holder which also knows the min and target versions * @return true if this permission requirement applies for the given versions */ protected boolean appliesTo(@NonNull PermissionHolder available) { if (firstApi == 0) { // initialized? firstApi = -1; // initialized, not specified // Not initialized Object o = annotation.getValue("apis"); if (o instanceof String) { String range = (String)o; // Currently only support the syntax "a..b" where a and b are inclusive end points // and where "a" and "b" are optional int index = range.indexOf(".."); if (index != -1) { try { if (index > 0) { firstApi = Integer.parseInt(range.substring(0, index)); } else { firstApi = 1; } if (index + 2 < range.length()) { lastApi = Integer.parseInt(range.substring(index + 2)); } else { lastApi = Integer.MAX_VALUE; } } catch (NumberFormatException ignore) { } } } } if (firstApi != -1) { AndroidVersion minSdkVersion = available.getMinSdkVersion(); if (minSdkVersion.getFeatureLevel() > lastApi) { return false; } AndroidVersion targetSdkVersion = available.getTargetSdkVersion(); if (targetSdkVersion.getFeatureLevel() < firstApi) { return false; } } return true; }