Whats the difference between RequiresApi
and TargetApi
?
Sample in kotlin:
@RequiresApi(api = Build.VERSION_CODES.M) @TargetApi(Build.VERSION_CODES.M) class FingerprintHandlerM() : FingerprintManager.AuthenticationCallback()
NOTE: FingerprintManager.AuthenticationCallback
requires api M
NOTE 2: if I dont use TargetApi lint fail with error class requires api level 23...
@RequiresApi
- Denotes that the annotated element should only be called on the given API level or higher.
@TargetApi
- Indicates that Lint should treat this type as targeting a given API level, no matter what the project target is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With