I am currently working on a android tv app but cant figure out how to change the icon for the now playing card that appears when i navigate away from the app whilst playing a video.
This link show that i need to set MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI with a uri formatted string but i either cant get the string formatted correctly or it does not work for some other reason.
currently i have this string -
"android.resource://"+ getPackageName() + "/drawable/app_icon_new"
full extract
final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder();
String title = video.getArtist().replace("_", " -");
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title);
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE,
video.getTrack());
metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title);
metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, video.getArtist());
String uri = "android.resource://"+ getPackageName() + "/drawable/app_icon_new";
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, uri);
Glide.with(this)
.load(Uri.parse(video.getThumbnailUrl()))
.asBitmap()
.into(new SimpleTarget<Bitmap>(500, 500) {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap);
mSession.setMetadata(metadataBuilder.build());
}
});
Any help would be greatly appreciated.
There is actually no way to change the Now Playing Icon as you can change it in the Recommendation Card. I hope that they'll fix this in a further update.