DEV Community

Meyti
Meyti

Posted on

Enable fullscreen view on nativescript-vue

import * as app from 'tns-core-modules/application'
import { device } from 'tns-core-modules/platform'

export function hideSystemUi () {
  if (!app.android || parseInt(device.sdkVersion) < 21) { return }
  const androidViewPkg = android.view // eslint-disable-line no-undef
  const window = app.android.startActivity.getWindow()
  window.addFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FULLSCREEN)
  window.clearFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
}

export function showSystemUi () {
  if (!app.android || parseInt(device.sdkVersion) < 21) { return }
  const androidViewPkg = android.view // eslint-disable-line no-undef
  const window = app.android.startActivity.getWindow()
  window.addFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
  window.clearFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FULLSCREEN)
}

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs