简体   繁体   English

停止访问Android设备中所有其他应用(启动器应用除外)

[英]Stop access to all other apps in Android Device except launcher app

I've created a launcher app, by adding following to the activity in manifest: 通过在清单中的活动中添加以下内容,我创建了启动器应用程序:

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

Now, my app is a launcher app, whenever I press back/home/menu buttons, it does ask me for switching launchers. 现在,我的应用程序是启动器应用程序,每当我按返回/主页/菜单按钮时,它的确要求我切换启动器。

Also, I still can open other apps by choosing home launcher, and I can still access settings and everything else. 此外,我仍然可以通过选择家庭启动器来打开其他应用,并且我仍然可以访问设置和其他所有内容。

What I need to achieve is, I need a complete cut-off for user to anything else in the device, the only way other apps are accessed, will be a programmatic call from launcher app. 我需要实现的是,我需要用户完全断开设备中的其他任何设备,访问其他应用程序的唯一方法是来自启动器应用程序的编程调用。

Please suggest how to achieve the same. 请提出如何实现相同的建议。

The only way to do this is with the DeviceManager API. 唯一的方法是使用DeviceManager API。 First, you have to become device owner. 首先,您必须成为设备所有者。 Then you can use the DeviceManager API to set yourself as the default launcher app. 然后,您可以使用DeviceManager API将自己设置为默认启动器应用程序。

Using that, you can make yourself the launcher and prevent other launchers from being started. 使用该工具,您可以使自己成为启动器,并阻止其他启动器启动。 However they can still use the status bar to launch settings, and get into other stuff through there. 但是,他们仍然可以使用状态栏启动设置,并通过那里进入其他内容。 You can prevent the status bar from expanding if you use the StatusbarManager API, but that requires you to use reflection to use private APIs and you'll need to be a system app (it uses system permissions). 如果使用StatusbarManager API,可以防止状态栏展开,但这需要您使用反射来使用私有API,并且您需要成为系统应用程序(它使用系统权限)。 It will also disallow any access to notifications. 它还将禁止对通知的任何访问。 If you need that, you'll probably need to make a custom Android OS image. 如果需要,您可能需要制作一个自定义的Android OS映像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM