Skip to content Skip to sidebar Skip to footer

Remoteview Is Not Applied In Background

I've applied Remoteview to notification. It works when user is in foreground, but when user is in background, notification is not showed as remoteview. How can I apply remoteview w

Solution 1:

You need to set two different views, one is custom content view and the other is Big content view and set it as follows -

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext())
            .setSmallIcon(icon)
            .setCustomContentView(contentViewSmall)
            .setCustomBigContentView(contentViewBig)
            .setContentTitle("Custom Notification")
            .setContentIntent(contentIntent)
            .setAutoCancel(true)
            .setWhen(when);

    mNotificationManager.notify(1, notificationBuilder.build());

Also read my blog on Custom Layouts for Push notifications

Post a Comment for "Remoteview Is Not Applied In Background"