Skip to content

Instantly share code, notes, and snippets.

@koral--
Created November 24, 2016 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koral--/8fb13654129a62c26ceb1de0ec29eedb to your computer and use it in GitHub Desktop.
Save koral--/8fb13654129a62c26ceb1de0ec29eedb to your computer and use it in GitHub Desktop.
VersionCodes
public static void foo() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
long x = JobInfo.getMinPeriodMillis(); //available on N+, no lint error
} else {
long x = JobInfo.getMinPeriodMillis(); //available on M-, lint error
}
if (isNougatOrAbove()) {
long x = JobInfo.getMinPeriodMillis(); //available on N+, no lint error
} else {
long x = JobInfo.getMinPeriodMillis(); //available on M-, lint check does not work!
}
}
public static boolean isNougatOrAbove() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment