将 Android 设备锁定到单个应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24127947/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:49:38  来源:igfitidea点击:

Lock Android Device to a Single Application

androidkiosk-mode

提问by Zapnologica

My company is looking at selling an Android device with an application on that will do a certain task as a product to replace an embedded device.

我的公司正在考虑销售带有应用程序的 Android 设备,该应用程序将作为替代嵌入式设备的产品执行特定任务。

However we need to some how lock the device to only have access to our application which we will develop and not be able to access the normal Android OS interface.

但是,我们需要了解如何锁定设备,使其只能访问我们将开发的应用程序,而无法访问正常的 Android 操作系统界面。

I would like the following:

我想要以下内容:

  1. When the device boots it must automatically load our application
  2. There must be no way to exit the application, (unless if we maybe enter a master password) which will allows you access to the device
  1. 当设备启动时,它必须自动加载我们的应用程序
  2. 必须没有办法退出应用程序,(除非我们可能输入主密码),这将允许您访问设备

Is this possible to do, and how would one go about doing this?

这是可能的,人们将如何去做?

采纳答案by Daniel

There are several different possible solutions for this problem which are mentioned below, but there is no "out of the box" solution implemented in Android. (Edit: At least not before Android 5.0)

对于这个问题,下面提到了几种不同的可能解决方案,但在 Android 中没有实现“开箱即用”的解决方案。(编辑:至少不是在 Android 5.0 之前)

  • Develop your application and activate it as standard Home Screen App/ Launcher. Users could only avoid this solution by booting in safe mode.
  • Develop your own kernel (as mentioned by Chloe at the comments)
  • Use a 3rd party application for this case. (This will mostly require root on your device) Different solutions are available at the Play Store (e.g. KioWareor SureLock). Search for Android Kiosk Modeto get more results.
  • 开发您的应用程序并将其激活为标准主屏幕应用程序/启动器。用户只能通过以安全模式启动来避免此解决方案。
  • 开发你自己的内核(正如 Chloe 在评论中提到的)
  • 在这种情况下使用第 3 方应用程序。(这主要需要在您的设备上使用 root) Play 商店提供了不同的解决方案(例如KioWareSureLock)。搜索Android Kiosk Mode以获得更多结果。

回答by Mark Melling

Lollipop (5.0) supports the concept of screen pinning, which is what I think you're after.

Lollipop (5.0) 支持屏幕固定的概念,我认为这正是您所追求的。

Android 5.0 introduces a new screen pinning API that lets you temporarily restrict users from leaving your task or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android, or a single-purpose or kiosk application. Once your app activates screen pinning, users cannot see notifications, access other apps, or return to the home screen, until your app exits the mode.

There are two ways to activate screen pinning:

Manually: Users can enable screen pinning in Settings > Security > Screen Pinning, and select the tasks they want to pin by touching the green pin icon in the recents screen.

Programmatically: To activate screen pinning programmatically, call startLockTask() from your app. If the requesting app is not a device owner, the user is prompted for confirmation. A device owner app can call the setLockTaskPackages() method to enable apps to be pinnable without the user confirmation step.

Android 5.0 引入了新的屏幕固定 API,可让您暂时限制用户离开您的任务或被通知打断。例如,如果您正在开发教育应用程序以支持 Android 上的高风险评估要求,或者单一用途或信息亭应用程序,则可以使用此方法。一旦您的应用激活屏幕固定,用户将无法看到通知、访问其他应用或返回主屏幕,直到您的应用退出该模式。

有两种方法可以激活屏幕固定:

手动:用户可以在设置 > 安全 > 屏幕固定中启用屏幕固定,并通过触摸最近屏幕中的绿色固定图标来选择他们想要固定的任务。

以编程方式:要以编程方式激活屏幕固定,请从您的应用中调用 startLockTask()。如果发出请求的应用程序不是设备所有者,则会提示用户进行确认。设备所有者应用程序可以调用 setLockTaskPackages() 方法使应用程序无需用户确认步骤即可固定。

https://developer.android.com/about/versions/android-5.0.html

https://developer.android.com/about/versions/android-5.0.html

回答by SoroushA

Starting Android 6.0, you can configure device policies for Corporate Owned Single Use (COSU) devices, which is an addition to what @Mark Melling pointed out.

从 Android 6.0 开始,您可以为企业拥有的单一用途 (COSU) 设备配置设备策略,这是对@Mark Melling 指出的补充。

As an IT administrator, you can configure Android 6.0 Marshmallow and later devices as corporate-owned, single-use (COSU) devices. These are Android devices used for a single purpose, such as digital signage, ticket printing, point of sale, or inventory management. To use Android devices as COSU devices, you need to develop Android apps that your customers can manage.

Your customers can configure COSU devices:

To lock a single application to the screen, and hide the Home and Recents buttons to prevent users from escaping the app. To allow multiple applications to appear on the screen, such as a library kiosk with a catalog app and web browser.

作为 IT 管理员,您可以将 Android 6.0 Marshmallow 及更高版本的设备配置为企业拥有的一次性 (COSU) 设备。这些是用于单一目的的 Android 设备,例如数字标牌、票务打印、销售点或库存管理。要将 Android 设备用作 COSU 设备,您需要开发客户可以管理的 Android 应用程序。

您的客户可以配置 COSU 设备:

将单个应用程序锁定到屏幕,并隐藏“主页”和“最近使用”按钮以防止用户退出应用程序。允许多个应用程序出现在屏幕上,例如带有目录应用程序和网络浏览器的图书馆亭。

http://developer.android.com/training/enterprise/cosu.html

http://developer.android.com/training/enterprise/cosu.html

回答by Fred

Google recently released the Android Management APIwhich allows to easily manage Android devices, lock them on a single application and set various other policies.

Google 最近发布了Android Management API,它允许轻松管理 Android 设备,将它们锁定在单个应用程序上并设置各种其他策略。

回答by David_131

Try MobiLock Pro, It helps you to turn down your Android device into kiosk modeby allowing only single app to run on the device all the time. It restricts user from accessing the home screen in Single app kiosk mode. Rebooting the device wouldn't exit the Single App kiosk mode as it continues to work after the reboot.

试试MobiLock Pro,它可以帮助您将 Android 设备调低到自助服务终端模式,方法是始终只允许一个应用程序在设备上运行。它限制用户在单一应用程序亭模式下访问主屏幕。重新启动设备不会退出单应用信息亭模式,因为它在重新启动后继续工作。

回答by Chirag Savsani

There are many apps available in the market which you can use for your problem.

市场上有许多应用程序可以用于解决您的问题。

Gokiosk - Kiosk Lockdown Androidis a nice app. And no need to root your device.

Gokiosk - Kiosk Lockdown Android是一款不错的应用。并且无需root您的设备。

All this is working as you mention above.

正如你上面提到的,所有这些都在起作用。