我已经成功实现了KIOSK模式应用程序,并且我能够阻止用户使用特定的应用程序。我的要求是,我必须使用我的应用程序在我的平板电脑中启用KIOSK模式,然后我需要允许用户打开第三方(我的另一个应用程序通过我的KIOSK应用程序预先安装在我的平板电脑中。我能够通过Android N(api 25)和Marshmallow设备(api 23)从三星s6边缘打开应用程序。但是当我用三星5.1进行测试时平板电脑,我无法通过Kisok应用程序打开我的应用程序。它向我显示“屏幕被固定。贵组织不允许取消固定。”任何帮助都表示赞赏。
我在设置锁定模式时添加了我的两个应用程序(Kisok和我的应用程序)包名称。一段代码正在使用6.0,6.1,7.0,7.1但不在5.1中。
答案 0 :(得分:0)
这个问题与this other question类似。 Android Marshmallow中的Kiosk功能得到了显着改进,这可能解释了为什么你无法在Android Lollipop上实现相同的行为。
Google提供的Android Management API应在Android Lollipop上提供向后兼容性,特别是允许在kiosk模式下运行应用,并从this page文档中复制以下政策。
"applications": [
{
"packageName": "com.example.custom_launcher",
"installType": "FORCE_INSTALLED",
"lockTaskAllowed": true,
"defaultPermissionPolicy": "GRANT",
},
{
"packageName": "com.example.app1",
"installType": "FORCE_INSTALLED",
"lockTaskAllowed": true,
"defaultPermissionPolicy": "GRANT",
}
],
"persistentPreferredActivities": [
{
"receiverActivity": "com.example.custom_launcher",
"actions": [
"android.intent.action.MAIN"
],
"categories": [
"android.intent.category.HOME",
"android.intent.category.DEFAULT"
]
}
]