Include the Package Dependencies
Step 6: Schedule EPG for App Install or Update
You must create or update the onInstallOrUpdateTask
to schedule your EPG Sync Task.
Step 1: Declare onInstallOrUpdateTask
in the manifest file
onInstallOrUpdateTask
task defined, don't create another one. Skip this step and merge the logic from Step 2 into your existing source file. For instance, it may be your OnInstallOrUpdate.ts file.
[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 onInstallOrUpdateTask
by creating a OnInstallOrUpdate.ts file in your src folder with the following content. This task runs on app installations and updates.
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: If the customer is entitled to any channels in your app,
// choose one of the options below to schedule an 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.
INFO ktf.tm.nests:Successfully scheduled EPG Sync task
Last updated: Sep 30, 2025