DefaultTileClient
public final class DefaultTileClient implements TileClient
Implementation of TileClient which can connect to a TileService in either the local process, or in a remote app.
This implementation will only stay connected for as long as required. Each call will cause this client to connect to the TileService, and call the specified remote method. It will then disconnect again after one second of inactivity (so calls in quick succession will share the same binder).
Note that there is a timeout of 10s when connecting to the TileService, and a timeout of 30s for requestTile and requestResources to return a payload.
Summary
Public constructors |
|---|
DefaultTileClient(Build an instance of |
DefaultTileClient(Build an instance of |
Public methods |
|
|---|---|
@NonNull ListenableFuture<@NonNull Integer> |
Gets the API version supported by the connected TileService. |
@NonNull ListenableFuture<@NonNull ResourceBuilders.Resources> |
This method is deprecated. Use |
@NonNull ListenableFuture<@NonNull TileBuilders.Tile> |
requestTile(@NonNull RequestBuilders.TileRequest requestParams)Request a tile payload from the connected TileService. |
@NonNull ListenableFuture<@NonNull ResourceBuilders.Resources> |
requestTileResourcesAsync(Request a resource bundle from the connected TileService. |
@NonNull ListenableFuture<Void> |
Send a Tile Added notification to the connected TileService. |
@NonNull ListenableFuture<Void> |
Send a Tile Enter notification to the connected TileService. |
@NonNull ListenableFuture<Void> |
Send a Tile Leave notification to the connected TileService. |
@NonNull ListenableFuture<Void> |
Send a Tile Removed notification to the connected TileService. |
Public constructors
DefaultTileClient
public DefaultTileClient(
@NonNull Context context,
@NonNull ComponentName componentName,
@NonNull Executor executor
)
Build an instance of DefaultTileClient for use with a given Executor.
| Parameters | |
|---|---|
@NonNull Context context |
The application context to use when binding to the |
@NonNull ComponentName componentName |
The |
@NonNull Executor executor |
An |
DefaultTileClient
public DefaultTileClient(
@NonNull Context context,
@NonNull ComponentName componentName,
@NonNull CoroutineScope coroutineScope,
@NonNull CoroutineDispatcher coroutineDispatcher
)
Build an instance of DefaultTileClient for use with a coroutine dispatcher.
| Parameters | |
|---|---|
@NonNull Context context |
The application context to use when binding to the |
@NonNull ComponentName componentName |
The |
@NonNull CoroutineScope coroutineScope |
A |
@NonNull CoroutineDispatcher coroutineDispatcher |
A |
Public methods
requestApiVersion
public @NonNull ListenableFuture<@NonNull Integer> requestApiVersion()
Gets the API version supported by the connected TileService.
requestResources
public @NonNull ListenableFuture<@NonNull ResourceBuilders.Resources>requestResources(
@NonNull RequestBuilders.ResourcesRequest requestParams
)
Request a resource bundle from the connected TileService.
requestTile
public @NonNull ListenableFuture<@NonNull TileBuilders.Tile> requestTile(@NonNull RequestBuilders.TileRequest requestParams)
Request a tile payload from the connected TileService.
requestTileResourcesAsync
public @NonNull ListenableFuture<@NonNull ResourceBuilders.Resources> requestTileResourcesAsync(
@NonNull RequestBuilders.ResourcesRequest requestParams
)
Request a resource bundle from the connected TileService.
sendOnTileAddedEvent
public @NonNull ListenableFuture<Void> sendOnTileAddedEvent()
Send a Tile Added notification to the connected TileService.
sendOnTileEnterEvent
public @NonNull ListenableFuture<Void> sendOnTileEnterEvent()
Send a Tile Enter notification to the connected TileService.
sendOnTileLeaveEvent
public @NonNull ListenableFuture<Void> sendOnTileLeaveEvent()
Send a Tile Leave notification to the connected TileService.
sendOnTileRemovedEvent
public @NonNull ListenableFuture<Void> sendOnTileRemovedEvent()
Send a Tile Removed notification to the connected TileService.