as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

Step 6: Schedule EPG for App Install or Update

If your app offers free Live content on app installation or you want to update channel lineup data on app updates, you should create or update the onInstallOrUpdateTask to schedule your EPG Sync Task. Otherwise, you can skip this step.

Step 1: Declare onInstallOrUpdateTask in the manifest file

Copied to clipboard.

[components]
## <other components related entries>
[[components.task]]
## Define the task that needs to run "On App Install/Update"
id = "<packageId>.onInstallOrUpdateTask"
runtime-module = "/com.amazon.kepler.headless.runtime.loader_2@IKeplerScript_2_0"

## Define a process group for each component
[processes]
## <other process related entries>
[[processes.group]]
component-ids = ["<packageId>.onInstallOrUpdateTask"]

[tasks]
## Ask the system to run your 'onInstallOrUpdateTask' task on installation and app updates
[[tasks.work]]
component-id = "<packageId>.onInstallOrUpdateTask"
mode = "install"

Step 2: Define your app's task

Define your app’s on-install/update task by creating a OnInstallOrUpdate.ts file in your src folder with the following content. Note that this task runs on app installation and (OTA) updates.

Copied to clipboard.

import {EpgSyncTaskScheduler} from '@amazon-devices/kepler-epg-sync-scheduler';
import { UtcTimePropertiesBuilder } from '@amazon-devices/kepler-epg-sync-scheduler';

const doTask = async (): Promise<void> => {
  console.info('Scheduling EPG Sync task');
  // TODO: Choose one of the options below to schedule EPG sync task.
  // If you call 'scheduleTask()' or 'scheduleTaskWithExecutionWindow()' multiple times,
  // the most recent EPG Sync Task method call will be fulfilled and persisted across reboots.

  // Option 1: Schedule EPG Sync task with a given interval.
  // If this is enabled, Please ensure that the test for `scheduleTask` is enabled in tst/task/OnInstallOrUpdateTask.test.ts
  await EpgSyncTaskScheduler.scheduleTask(
    '<packageId>.epgSyncTask', // component id of the sync task
    60 * 24, // 24 hours in mins
  );

  // Option 2: Schedule task with a execution window, i.e. run task between 2am - 4am UTC every day.
  // If this is enabled, Please ensure that the test for `scheduleTaskWithExecutionWindow` is enabled in tst/task/OnInstallOrUpdateTask.test.ts
  // let timeProperties = new UtcTimePropertiesBuilder()
  //   .startHour(2)
  //   .startMinute(0)
  //   .startSecond(0)
  //   .executionWindowInMinutes(120)
  //   .build();
  // await EpgSyncTaskScheduler.scheduleTaskWithExecutionWindow(
  //   '<packageId>.epgSyncTask', // component id of the sync task
  //   timeProperties,
  // );
};

export default doTask;

When your onInstallOrUpdate task runs, you should see a log line similar to the following.

Copied to clipboard.

INFO ktf.tm.nests:Successfully scheduled EPG Sync task

Last updated: Sep 30, 2025