protected static function getHooks()
 {
     $app = new AppInfo\Application();
     return $app->getContainer()->query('Hooks');
 }
<?php

/**
 * ownCloud - sharing_group
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Eric <*****@*****.**>
 * @copyright Eric 2015
 */
namespace OCA\Sharing_Group\AppInfo;

use OCP\AppFramework\App;
$app = new Application();
$container = $app->getContainer();
$container->query('UserHooks')->register();
$container->query('OCP\\INavigationManager')->add(function () use($container) {
    $urlGenerator = $container->query('OCP\\IURLGenerator');
    $l10n = $container->query('OCP\\IL10N');
    return ['id' => 'sharing_group', 'order' => 10, 'href' => $urlGenerator->linkToRoute('sharing_group.page.index'), 'icon' => $urlGenerator->imagePath('sharing_group', 'app.svg'), 'name' => $l10n->t('Sharing Group')];
});
if (defined('\\OCP\\Share::SHARE_TYPE_SHARING_GROUP')) {
    \OCA\Sharing_Group\FilesHooksStatic::register();
    \OC::$server->getActivityManager()->registerExtension(function () {
        return new \OCA\Sharing_Group\Activity(\OC::$server->query('L10NFactory'));
    });
}