Disable large icon inside a notification (Android)

569 views
Skip to first unread message

abhi...@quintoapp.com

unread,
Mar 4, 2016, 2:37:33 AM3/4/16
to CleverTap Support
I would only like to show the small icon, not the large.

 
 NotificationCompat.Builder mBuilder =
                   
new NotificationCompat.Builder(this)
                           
//.setLargeIcon(icon)
                           
// .addAction(R.drawable.send_bot, "No", pendingIntentNo)
                           
.setSmallIcon(R.drawable.notification)
                           
.setContentTitle(msg.getString("nt"))
                           
.setStyle(new NotificationCompat.BigTextStyle()
                                   
.bigText(msg.getString("nm")))
                           
.setColor(Color.parseColor("#c33333"))
                           
.setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
                           
.setContentText(msg.getString("nm"));
However, the above doesn't  work. It still shows both large and small icon. (Post Android Lollipop)

Jay Dalvi

unread,
Mar 4, 2016, 4:57:29 AM3/4/16
to CleverTap Support
Abhilash,

I believe your query is related to Android, not CleverTap.

Our documentation explains handling App Icons on notifications for Android 5+ : https://support.clevertap.com/integration/android-sdk/#notification-icons-as-of-android-5--lollipop

Thanks,

Support

abhi...@quintoapp.com

unread,
Mar 4, 2016, 6:34:13 AM3/4/16
to CleverTap Support

The first image is created using the below code. And that is the kind i want.

NotificationCompat.Builder mBuilder =
 
new NotificationCompat.Builder(this)
 
//.setLargeIcon(icon)
 
// .addAction(R.drawable.send_bot, "No", pendingIntentNo)
 
.setSmallIcon(R.drawable.notification)
 
.setContentTitle(msg.getString("nt"))
 
.setStyle(new NotificationCompat.BigTextStyle()
 
.bigText(msg.getString("nm")))
 
.setColor(Color.parseColor("#c33333"))
 
.setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
 
.setContentText(msg.getString("nm"));

The second Image (with square icon and another small icon attached to it) is generated via 
CleverTapAPI.createNotification(context, extras);
The problem is that i will have to use
CleverTapAPI.createNotification(context, extras);
to generate notification, otherwise the click events won't be captured in case of Campaign based notifications. That is what was happening till now. That was the only reason I had to move away from my custom builder.

CleverTap Support

unread,
Mar 4, 2016, 7:49:20 AM3/4/16
to CleverTap Support
Abhilash,

Not sure what you're doing here. Like I mentioned over the call this morning, you have to parse our Payload. This can be avoided if you use parse are payload on your notification extras.

- Support.

Reply all
Reply to author
Forward
0 new messages