1
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setLargeIcon(b) .setContentTitle("this a message!") .setContentText("Hello world"); 

can I use only setLagreIcon() or any other alternative solution?

1 Answer 1

0

From documentation:

A Notification object must contain the following:

  • A small icon, set by setSmallIcon()
  • A title, set by setContentTitle()
  • Detail text, set by setContentText()

So no, this is not possible.

Edit: A really unsafe and not recommended method seems to be explained here.

Sign up to request clarification or add additional context in comments.

2 Comments

I have seen the documentation. but I discover that many other app's notification are displayed only large bitmap.can you explain the issue?thanks !
Are you sure they only use the largeIcon? I know there are many issues with a non white small icon. I added a method to accomplish this in my answer, I have not tried it myself.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.