Use @AfterPermissionGranted for automatic execution
masterThe @AfterPermissionGranted annotation allows you to specify a method that should automatically execute once all permissions associated with a specific requestCode are granted.
Requirements:
- The annotated method must be
void(or returnUnitin Kotlin). - The annotated method must have no input parameters.
- The
requestCodeused in the annotation must match therequestCodeused in therequestPermissionscall.
@AfterPermissionGranted(REQUEST_CODE_LOCATION_AND_CONTACTS_PERMISSION)
private fun methodRequiresTwoPermission() {
// This runs automatically after permissions are granted
}