not getting albumart on lockscreen inspite of putting bitmap in metadata

By pranay bansal

i am unable to get albumart on lockscreen , i have tried using both METADATA_KEY_ALBUM_ART and METADATA_KEY_ART but nothing worked .here is my code

    byte[] data = null;
    try {
        mmr.setDataSource(music.getNowPlayingList().get(currentIndex).getPath());
        data = mmr.getEmbeddedPicture();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (music.getNowPlayingList()!=null && music.getNowPlayingList().size()>music.getIndexOfCurrentSong()) {
        GildeUtils.getBitmapFromGlide(this,data , new GlideInterface() {
            @Override
            public void getBitmap(Bitmap bitmap) {
                Bitmap b = BitmapFactory.decodeResource(getResources(),R.drawable.nowplaying);
                        mediaSession.setMetadata(new MediaMetadataCompat.Builder()
                        .putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART,b)
                        .putBitmap(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON,b)
                        .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, music.getNowPlayingList().get(currentIndex).getArtist())
                        .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, music.getNowPlayingList().get(currentIndex).getAlbum())
                        .putString(MediaMetadataCompat.METADATA_KEY_TITLE, music.getNowPlayingList().get(currentIndex).getTitle())
                        .build());
            }
        });
    }

i have also made mediastyle notification and also set the albumart as large icon as mentioned in other questions. also added mediasession.setActive(true) .

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273