presentation-core-application¶
The entry point and composition root for the Home Kiosk application.
Overview¶
This module contains the Application class and the primary AndroidManifest.xml. It doesn't implement features itself; instead, it stitches together the data, domain, and presentation features into a single executable APK.
Features¶
- Global DI Hub: Initializes Koin and loads all sub-module dependency graphs.
- App Startup: Manages the transition from the splash screen to the main UI.
- Persistent Services: Starts and manages the lifecycle of the
MqttServiceand other platform background tasks. - Permission Management: Centralized declaration of hardware and system permissions.
- Form-Factor Selection: Owns the app
BuildConfigand theformfactorflavor dimension that produces mobile and Android TV builds.
Key Files¶
YahkApplication.kt: Bootstraps the app, DI, and system receivers.di/AppModule.kt: The master list of all Koin modules in the project.AndroidManifest.xml: The source of truth for app components and required permissions.src/tv/AndroidManifest.xml: app-module TV overlay — launcher banner +MotionServiceservice type (leanback declarations live inpresentation-feature-host).
Build Configuration¶
This module uses the dev.yahk.convention.application plugin, which applies the com.android.application plugin and configures signing, SDK versions, and base Compose dependencies.
Android TV¶
This module makes the app installable and launchable on Android TV via the formfactor flavor dimension.
BuildConfig.IS_TV: Theformfactordimension sets this flag —falseformobile,truefortv. Combined flavor names look likefossTv, so per-dimension fields (FLAVOR_formfactor,FLAVOR_distribution) are used to test one dimension alone.- Early seeding:
YahkApplicationsetsAppConfig.buildFlagIsTv = BuildConfig.IS_TVbefore Koin starts, so atvbuild behaves as TV even if the device fails to report the leanback feature (e.g. a sideloaded APK). Feature libraries read this through the injectedAppConfigabstraction (inpresentation-core-platform), neverBuildConfigdirectly. - TV-aware startup: The
BatteryReceiveris skipped whenAppConfig.isTvis true, since TV boxes have no battery. src/tv/AndroidManifest.xml(merged only intotv*variants):- Declares
android:banner="@drawable/tv_banner"on<application>, required for the app to appear in the Android TV launcher's Apps row. - Redeclares
MotionServicewithforegroundServiceType="camera|specialUse"to cover both the external/USB camera path and the camera-less (MQTT presence) path on Android 14+. - Carries only these
<application>-level bits. The leanback declarations (android.software.leanback/ touchscreen / camera / microphonerequired="false") and theLEANBACK_LAUNCHERintent-filter live in thepresentation-feature-hostTV overlay (alongsideHostActivity).
- Declares
- App-drawer enumeration: The main manifest's
<queries>block declares bothLAUNCHERandLEANBACK_LAUNCHERcategories so TV-only apps are enumerable by the kiosk launcher on API 30+.