Thank You for your answer. I didn't know the Util class by now. It's nice!
As I mentioned, I was following the app tutorial for the so called "ownnotes" app and therefore didn't have to register any Service in app.php, as it is done in the activity app.
I think the notecontroller and noteservice for example is solved and instantiated automatically.
I think I am a little bit confused by the different approaches, like the directory structure ("lib" directory in activity app vs. "controller", "service", "mapper" directories in the tutorial) and the registering of Services with returning of an object, on one hand and the constructor method which is called automatically, on the other hand. For me it seems like it is a lot easier to go the automatic way, like in the tutorial.
I will connect the Hook in my app.php and add a Hooks class to my app. The Hooks class should now call a method in the NoteService class, which is completely the same as in the app-tutorial and has a method for deleting all notes of a specific user.
For me it seems that I have to inject the NoteService class, but if I follow the way of the activity app, I would have to register even the NoteMapper class, in order to register the NoteService calls, so that i can call a method in it. Am I right or do I get something wrong?