# TilesTimelineManager

Artifact: [androidx.wear.tiles:tiles-renderer](https://developer.android.com/jetpack/androidx/releases/wear-tiles) [View Source](https://cs.android.com/search?q=file:androidx/wear/tiles/timeline/TilesTimelineManager.java+class:androidx.wear.tiles.timeline.TilesTimelineManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.0.0)

*** ** * ** ***


```
public class TilesTimelineManager implements AutoCloseable
```

<br />

*** ** * ** ***

Manager for a single Wear Tiles timeline.

This handles the dispatching of single Tile layouts from a full timeline. It will set the correct alarms to detect when a layout should be updated, and dispatch it to its listener.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Clock` Interface so this manager can retrieve the current time. |
| `public interface https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.LayoutUpdateListener` Type to listen for layout updates from a given timeline. |
| `public interface https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Listener` **This interface is deprecated.** Use `https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.LayoutUpdateListener` instead. <br /> |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#TilesTimelineManager(android.app.AlarmManager,androidx.wear.tiles.timeline.TilesTimelineManager.Clock,androidx.wear.protolayout.TimelineBuilders.Timeline,int,java.util.concurrent.Executor,androidx.wear.tiles.timeline.TilesTimelineManager.LayoutUpdateListener)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/AlarmManager.html alarmManager, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Clock clock, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline timeline, int token, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html listenerExecutor, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.LayoutUpdateListener listener )` Default constructor. |
| `[TilesTimelineManager](https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#TilesTimelineManager(android.app.AlarmManager,androidx.wear.tiles.timeline.TilesTimelineManager.Clock,androidx.wear.tiles.TimelineBuilders.Timeline,int,java.util.concurrent.Executor,androidx.wear.tiles.timeline.TilesTimelineManager.Listener))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/AlarmManager.html alarmManager, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Clock clock, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/TimelineBuilders.Timeline timeline, int token, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html listenerExecutor, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Listener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#TilesTimelineManager(android.app.AlarmManager,androidx.wear.tiles.timeline.TilesTimelineManager.Clock,androidx.wear.protolayout.TimelineBuilders.Timeline,int,java.util.concurrent.Executor,androidx.wear.tiles.timeline.TilesTimelineManager.LayoutUpdateListener)` instead. <br /> |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#close()()` Tears down this Timeline Manager. |
| `void` | `https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#init()()` Sets up this Timeline Manager. |

## Public constructors

### TilesTimelineManager

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public TilesTimelineManager(
    @NonNull AlarmManager alarmManager,
    @NonNull TilesTimelineManager.Clock clock,
    @NonNull TimelineBuilders.Timeline timeline,
    int token,
    @NonNull Executor listenerExecutor,
    @NonNull TilesTimelineManager.LayoutUpdateListener listener
)
```

Default constructor.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/AlarmManager.html alarmManager` | An AlarmManager instance suitable for setting RTC alarms on. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Clock clock` | A Clock to use to ascertain the current time (and hence which tile to show). This should be synchronized to the same clock as used by `alarmManager` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline timeline` | The Tiles timeline to use. |
| `int token` | A token, which will be passed to `listener`'s callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html listenerExecutor` | the executor for `listener` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.LayoutUpdateListener listener` | A listener instance, called when a new timeline entry is available. |

### TilesTimelineManager

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public [TilesTimelineManager](https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#TilesTimelineManager(android.app.AlarmManager,androidx.wear.tiles.timeline.TilesTimelineManager.Clock,androidx.wear.tiles.TimelineBuilders.Timeline,int,java.util.concurrent.Executor,androidx.wear.tiles.timeline.TilesTimelineManager.Listener))(
    @NonNull AlarmManager alarmManager,
    @NonNull TilesTimelineManager.Clock clock,
    @NonNull TimelineBuilders.Timeline timeline,
    int token,
    @NonNull Executor listenerExecutor,
    @NonNull TilesTimelineManager.Listener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager#TilesTimelineManager(android.app.AlarmManager,androidx.wear.tiles.timeline.TilesTimelineManager.Clock,androidx.wear.protolayout.TimelineBuilders.Timeline,int,java.util.concurrent.Executor,androidx.wear.tiles.timeline.TilesTimelineManager.LayoutUpdateListener)` instead.

Default constructor.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/AlarmManager.html alarmManager` | An AlarmManager instance suitable for setting RTC alarms on. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Clock clock` | A Clock to use to ascertain the current time (and hence which tile to show). This should be synchronized to the same clock as used by `alarmManager` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/TimelineBuilders.Timeline timeline` | The Tiles timeline to use. |
| `int token` | A token, which will be passed to `listener`'s callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html listenerExecutor` | the executor for `listener` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/timeline/TilesTimelineManager.Listener listener` | A listener instance, called when a new timeline entry is available. |

## Public methods

### close

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.0.0)

```
public void close()
```

Tears down this Timeline Manager. This will ensure any set alarms are cleared up.

### init

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.0.0)

```
public void init()
```

Sets up this Timeline Manager. This will cause the timeline manager to dispatch the first layout, and set its first alarm.