Skip to main content

Base App and Launching

BaseApp owns framework bootstrap, shared services, scene-level views, the main loop, and post-launch runtime services. Its constructor calls begin() immediately; subclasses should use lifecycle hooks instead of trying to perform work after super(...) but before launch starts.

Synchronous Bootstrap

begin() performs this setup before the asynchronous launch sequence:

  1. Prepare and observe the scene.
  2. Create and configure the IoC container.
  3. Assign platform/base services, then run beforeLaunch().
  4. Resolve injected app dependencies.
  5. Add scene-level views, begin app launch, and start the main loop.

Views such as DialogManagerView are created only after IoC dependencies are resolved because their decorators may resolve services during construction.

Asynchronous Launch Sequence

BaseApp completes synchronous bootstrap, an ordered eight-stage asynchronous launch, and post-launch debugger, input, orientation, and keyboard servicesBaseApp completes synchronous bootstrap, an ordered eight-stage asynchronous launch, and post-launch debugger, input, orientation, and keyboard services

runAppLaunchSequence() currently runs eight stages in order:

  1. Load build config. Failure is logged and launch continues.
  2. Initialize async services.
  3. Load AppConfig.
  4. Initialize the non-Roku class registry; failure falls back to defaults.
  5. Configure the device, AppConfig, and performance manager.
  6. Load theme shapes.
  7. Pre-create configured SceneGraph views.
  8. Preload instance pools; failure falls back to on-demand allocation.

After the promise resolves, BaseApp connects remote debugging, calls onLaunch(), registers input adapters, and starts orientation and keyboard inset services. A rejected required stage is logged and prevents those post-launch steps.

Tip: Initialization Order

Order matters. IoC must exist before any views relying on injected services are instantiated.

IoC Access

  • Use @inject() without args to resolve by property name, or @inject('key') to resolve by explicit key.
  • Use AppUtils.resolve<T>(key, required?) and AppUtils.register(key, value) outside initializer code. There is no public static IoCContainer.resolve() shortcut.
Where Services Come From

PlatformAppInitializer provides platform overrides (e.g., hosannaDevice), while apps add custom services via getCustomIOCServices().

Talk to us