This is an Android Notification question. Help me!

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

I'm making a weather app.

I'm making a notification. I don't see icon and appname like the notification (weow app) at the top, and I want to create a notification with no empty space around it.

However, no matter what you do, it doesn't come out like that, and it can be minimized/maximized like the second notification (notification of the app I created), and the notification is generated so that you can see the icon and appname.

I looked it up and said that the priority of the notification should be the highest priority, or that the value of setWhen should be set to zero when the notification is generated, but it doesn't work at all.

How can we create custom notifications that are always maximized?

Link name

That's the same question as this.

This is my code.

builder.setPriority(NotificationCompat.PRIORITY_DEFAULT).setVibrate(new long[]{0L}).setDefaults(NotificationCompat.DEFAULT_LIGHTS |

NotificationCompat.DEFAULT_SOUND).setSound(null).setSilent(true).setOngoing(true)

.setSmallIcon(icon).setCustomContentView(remoteViews)

.setStyle(new androidx.media.app.NotificationCompat.DecoratedMediaCustomViewStyle())

.setCustomBigContentView(remoteViews).setShowWhen(false).setAutoCancel(false);

Notification notification = builder.build();

android

2022-09-20 11:18

1 Answers

I solved it myself in a week. The build sdk version was the problem I've been working with sdk at 31, but I tried 30 just in case and it worked out.


2022-09-20 11:18

If you have any answers or tips


© 2022 pinfo. All rights reserved.