@echo off setlocal EnableExtensions DisableDelayedExpansion rem Android 12+; uses existing Google Platform-Tools and one USB-connected player. rem Does not provision Device Owner, change USB security or modify operating hours. if "%~1"=="" goto usage set "KIOSK_ADB=%CD%\adb.exe" if not exist "%KIOSK_ADB%" set "KIOSK_ADB=%~dp0adb.exe" if not exist "%KIOSK_ADB%" set "KIOSK_ADB=%~dp0platform-tools\adb.exe" if not exist "%KIOSK_ADB%" ( echo ERROR: Place this script in the platform-tools folder beside adb.exe. exit /b 1 ) "%KIOSK_ADB%" -d get-state if errorlevel 1 ( echo ERROR: Connect exactly one authorized USB Android player, then retry. exit /b 1 ) if /i "%~1"=="--configure-only" goto configure if not exist "%~1" ( echo ERROR: APK file not found. exit /b 1 ) "%KIOSK_ADB%" -d install -r "%~1" if errorlevel 1 exit /b 1 :configure "%KIOSK_ADB%" -d shell pm path biz.stino.kiosk | findstr /b /c:"package:" >nul if errorlevel 1 ( echo ERROR: The Kiosk app biz.stino.kiosk is not installed. exit /b 1 ) "%KIOSK_ADB%" -d shell cmd appops set biz.stino.kiosk SCHEDULE_EXACT_ALARM allow if errorlevel 1 ( echo ERROR: Android did not accept exact alarm access. Check the Android version. exit /b 1 ) "%KIOSK_ADB%" -d shell cmd appops get biz.stino.kiosk SCHEDULE_EXACT_ALARM | findstr /c:"SCHEDULE_EXACT_ALARM: allow" if errorlevel 1 ( echo ERROR: Exact alarm access was not verified. exit /b 1 ) echo Exact alarm access enabled and verified. echo Device Owner is additionally required for automatic display ON/OFF. echo Saved operating hours may now switch the display off immediately. if /i "%~1"=="--configure-only" exit /b 0 "%KIOSK_ADB%" -d shell am start -n biz.stino.kiosk/.MainActivity exit /b %errorlevel% :usage echo Usage: .\%~nx0 .\STiNO-Kiosk-1.1.9.apk echo Existing app: .\%~nx0 --configure-only echo Place beside adb.exe; requires one USB player with authorized ADB access. exit /b 1