0

explain fast: problem: put image in background behind list of notification... I tryied: with a bigpicture, but It isn't that I want to...

Well, I saw a apps that have a notification custom, like this below...

enter image description here

enter image description here

I want a custom background, but i don't know how to do this, i found other examples, but i explain how to change the notification, like custom, background, buttons, icon,etc. but i don't found a specific solution...

links that i found:

android lollipop notification background colour

Change Notification Layout

I will apretiate you help.

Community
  • 1
  • 1
DarckBlezzer
  • 4,578
  • 1
  • 41
  • 51

2 Answers2

1

Is it a media controller app?

Because: The solution you want only works for applications that have registered itself as a media controller, so apps that don't play audio can't/shouldn't use this mechanism to change the lockscreen wallpaper.

Parth Parikh
  • 130
  • 9
  • Yes It is a media app, It is deezer app, then, I can't do that in my aplication?... – DarckBlezzer Mar 17 '16 at 22:15
  • It can be done using RemoteControlClient, part of Android since ICS. If you want a working example, download VLC for Android and check out org.videolan.vlc.AudioService: This part of the code is to intercept media controls. – Parth Parikh Mar 17 '16 at 22:19
1
/**
* Set up the remote control and tell the system we want to be the default receiver for the MEDIA buttons
* @see http://android-developers.blogspot.fr/2010/06/allowing-applications-to-play-nicer.html
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void setUpRemoteControlClient() {
Context context = VLCApplication.getAppContext();
AudioManager audioManager = (AudioManager)context.getSystemService(AUDIO_SERVICE);

if(Util.isICSOrLater()) {
    audioManager.registerMediaButtonEventReceiver(mRemoteControlClientReceiverComponent);

    if (mRemoteControlClient == null) {
        Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
        mediaButtonIntent.setComponent(mRemoteControlClientReceiverComponent);
        PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context, 0, mediaButtonIntent, 0);

        // create and register the remote control client
        mRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
        audioManager.registerRemoteControlClient(mRemoteControlClient);
    }

    mRemoteControlClient.setTransportControlFlags(
            RemoteControlClient.FLAG_KEY_MEDIA_PLAY |
            RemoteControlClient.FLAG_KEY_MEDIA_PAUSE |
            RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
            RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
            RemoteControlClient.FLAG_KEY_MEDIA_STOP);
} else if (Util.isFroyoOrLater()) {
    audioManager.registerMediaButtonEventReceiver(mRemoteControlClientReceiverComponent);
    }
}

This part is to update artwork, among other info:

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void updateRemoteControlClientMetadata() {
if(!Util.isICSOrLater()) // NOP check
    return;

if (mRemoteControlClient != null) {
    MetadataEditor editor = mRemoteControlClient.editMetadata(true);
    editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, getCurrentMedia().getAlbum());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, getCurrentMedia().getArtist());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_GENRE, getCurrentMedia().getGenre());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, getCurrentMedia().getTitle());
    editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, getCurrentMedia().getLength());
    editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, getCover());
    editor.apply();
}
}
Parth Parikh
  • 130
  • 9