Using FLAG_FULLSCREEN and TYPE_KEYGUARD together.

To create a lockdown application on Android, I tried to use FLAG_FULLSCREEN and TYPE_KEYGUARD simultaneously, however using only one of them worked fine but no luck using them together.

To avoid this problem, full screen feature seems to be done by AndroidManifest.xml.

To do so, add android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" to activity node in AndroidManifest.xml and add following code to Activity class

override def onAttachedToWindow() {
getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD)
super.onAttachedToWidnow
}

Comments

Popular posts from this blog

Subclassing and Signal connect on a same widget crashes PySide application on exit.

Calling OpenCV functions via Cython from Python 3.X.

Showing CPU/Memory usage on tmux status bar(tmuxのステータスバーにCPUとMemoryの使用状況を表示する)