private static void checkActivityObject(@Nullable final ComponentActivity activity) {
        Objects.requireNonNull(activity);
        final List<Class<?>> neededClasses = Arrays.asList(LifecycleOwner.class, Context.class);
        for (Class<?> nc : neededClasses) {
            if (!nc.isAssignableFrom(activity.getClass())) {
                throw new IllegalStateException("Subject must implement all of: " + neededClasses + " but doesn't implement: " + nc);
            }
        }
        if (((LifecycleOwner) activity).getLifecycle().getCurrentState() != INITIALIZED) {
            throw new IllegalStateException("Lifecycle must be in state INITIALIZED when creating launchers: " + activity.getClass().getName());
        }
    }
creates and registers a permission action with an Activity
main/src/main/java/cgeo/geocaching/permission/PermissionAction.java