Google supports Java annotation @RequiresApi(number) which can be applied to classes, methods, member variables, etc. This can be used to trigger linting errors/warnings if an API was accessed on an API Level older that what was set in the annotation.
We should leverage this feature throughout our core Titanium code to help minimize mistakes and ensure we're checking the currently running API Level before making high API Level call. This will help avoid crashes when on older Android OS versions.
The below screenshot shows this in action. A @RequiresApi(20) annotation is applied to method onApplyWindowInsets(). In the method below, we call the onApplyWindowInsets() method twice. One call is unguarded and the other call is within an if-check block which checks if we're running in API Level 20 or higher. The linting tool correctly shows a red underline for the unguarded method call. This is what we want.
We should do this after switching our build system to gradle. This is because the gradle linting tool performs the API Level checks.
Also, the @RequireApi() annotation requires the following Google support library...