简体   繁体   English

Android - Lollipop Screen固定是否适用于同一个应用中的多个活动?

[英]Android - Does Lollipop Screen pinning work across multiple activities in the same app?

I'm attempting to add kiosk functionality to an android application. 我正在尝试将自助服务终端功能添加到Android应用程序中。 I'm hoping to take advantage of Lollipop's screen pinning feature to automatically pin the app once it starts. 我希望利用Lollipop的屏幕固定功能,一旦启动就自动固定应用程序。 The app UI has been built with several different activities. 应用程序UI已经构建了几个不同的活动。 I call startLockTask() once during the onCreate() method of the entry-point activity however as soon as I navigate to another activity within the app it unpins. 我在入口点活动的onCreate()方法中调用了一次startLockTask() ,但是一旦我导航到应用程序中的另一个活动,它就会取消。

Do I need to call startLockTask() in every activity during onCreate()/onResume() ? onCreate()/onResume()期间,我是否需要在每个活动中调用startLockTask() onCreate()/onResume() This will produce a poor user experience as the "Screen pinned" toast will appear every time I move from one activity to another within the app. 这将产生糟糕的用户体验,因为每次我在应用程序中从一个活动移动到另一个活动时,将出现“屏幕固定”烤面包。

I'm developing the app on a Moto E (2nd gen) running Android 5.0.2. 我正在开发运行Android 5.0.2的Moto E(第二代)上的应用程序。

Android Lollipop's Screen Pinning feature pins a Single Task NOT an Activity on the screen. Android Lollipop的屏幕固定功能可以在屏幕上固定单个任务而不是活动。 So if your activities are in one single task then yes you can play/switch between activities in screen pinning mode. 因此,如果您的活动在一个单一任务中,则可以在屏幕固定模式下播放/切换活动。

For more details you can check this official information: https://developer.android.com/about/versions/android-5.0.html#Enterprise > Screen pinning 有关详细信息,请查看以下官方信息: https//developer.android.com/about/versions/android-5.0.html#Enterprise >屏幕固定

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

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