Search code examples
androidandroid-5.0-lollipopandroid-screen-pinning

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


I'm attempting to add kiosk functionality to an android application. I'm hoping to take advantage of Lollipop's screen pinning feature to automatically pin the app once it starts. The app UI has been built with several different activities. 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.

Do I need to call startLockTask() in every activity during 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.


Solution

  • Android Lollipop's Screen Pinning feature pins a Single Task NOT an Activity on the screen. 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