So as the question says: I'm trying to get pagination working for Android Auto with media3, but the documentation seems to be either lacking or I can't find it.
I currently have a MediaService
that extends MediaLibraryService
class MediaService : MediaLibraryService() {
// extra code here
override fun onGetLibraryRoot(
session: MediaLibrarySession,
browser: ControllerInfo,
params: LibraryParams?
): ListenableFuture<LibraryResult<MediaItem>> {
// get root here
}
override fun onGetItem(
session: MediaLibrarySession,
browser: ControllerInfo,
mediaId: String
): ListenableFuture<LibraryResult<MediaItem>> {
// get item with id
}
override fun onGetChildren(
session: MediaLibrarySession,
browser: ControllerInfo,
parentId: String,
page: Int,
pageSize: Int,
params: LibraryParams?
): ListenableFuture<LibraryResult<ImmutableList<MediaItem>>> {
// get children of item with id
}
// extra code here
}
The pagination should be achieved with page
and pageSize
in onGetChildren
, but these are always 0
and Int.MAX_VALUE
. How do you tell Android Auto that it has to ask for different values or that it needs to paginate?