2

I am using big-contentview for notification message using remoteViews. That big content view shows good in nexus 7 but in Samsung 10" tablet showing like collapsed layout. And other application like Google play music shows only collapsed notification only.

I tested with SM-T520 (10" tablet)

1) Wther no support for bigcontentview in tablet/samsung.

2) Or how to handle to show a collapsed notification in such a condition.

1st Pic : This is the samsung tablet screen, that bigcontentview not fully visible.

This is the samsung tablet screen, that bigcontentview not fully visible.

2nd Pic : Expected Output.

Expected Output

layout-v16 I had expand layout.

layout-v11 I had collapsed layout.

Code (Java) :

     mNotificationTemplate = new RemoteViews(mContext.getPackageName(),
            R.layout.notification_download_latest);

    if (NotificationHelper.hasHoneycomb()) { // Notification Builder
        mNotification = new NotificationCompat.Builder(mContext)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentIntent(getPendingIntent(mContext, url))
                .setPriority(Notification.PRIORITY_DEFAULT)
                .setOngoing(true).setContent(mNotificationTemplate).build();
        if (NotificationHelper.hasJellyBean()) {
            // Expanded notifiction style
            // mExpandedView = new RemoteViews(context.getPackageName(), //
            // R.layout.notification_download_latest);

            **mNotification.bigContentView = mNotificationTemplate;**
            mNotificationTemplate.setOnClickPendingIntent(
                    R.id.notification_cancelBtn,
                    getPendingIntent(mContext, url));
Ashraf
  • 3,114
  • 3
  • 23
  • 22

2 Answers2

6

On the Samsung, your Notification is not at the top. Only the top-most Notification will be automatically shown expanded.

Hence, the behavior is perfectly normal.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
5

You need to set priority:

mNotification.priority=NotificationCompat.PRIORITY_MAX;
Master
  • 690
  • 6
  • 18
  • Finally I moved with this priority to show the notification without collapse. – Ashraf Nov 17 '14 at 05:48
  • Thank you, after an hour of tinkering around with remote views and bigContentView without success I finally found this! – Mark Apr 25 '16 at 23:54