Notification Bubble not showing

Viewed 1517

for some reason whenever I send a notification the notification bubble does not show up. Ive allowed notification bubbles from the developer options and compileSdkVersion is 29. Bubble activity just has a button in it for testing purposes. Any help will be greatly appreciated.

My code:

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            NotificationManager notificationManager = mContext.getSystemService(NotificationManager.class);

            // set up notification channel
            NotificationChannel channel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
            channel.setDescription(CHANNEL_DESCRIPTION);
            if (notificationManager != null) {
                notificationManager.createNotificationChannel(channel);
            }

            // create person
            Person person = new Person.Builder()
                    .setName("Notification")
                    .setIcon(Icon.createWithResource(mContext, R.drawable.ic_notification))
                    .setBot(true)
                    .setImportant(true)
                    .build();

            // create bubble meta data
            Intent target = new Intent(mContext, BubbleActivity.class);
            PendingIntent bubbleIntent = PendingIntent.getActivity(mContext, 0, target, PendingIntent.FLAG_UPDATE_CURRENT);

            Notification.BubbleMetadata bubbleMetadata = new Notification.BubbleMetadata.Builder()
                    .setDesiredHeight(300)
                    .setIcon(Icon.createWithResource(mContext, R.drawable.ic_notification))
                    .setSuppressNotification(true)
                    .setAutoExpandBubble(false)
                    .setIntent(bubbleIntent)
                    .build();

            // create message style
            Notification.MessagingStyle style = new Notification.MessagingStyle(person)
                    .setGroupConversation(false)
                    .addMessage("notification", currentTimeMillis(), person);

            // create notification intent
            Intent target2 = new Intent(mContext.getApplicationContext(), LaunchActivity.class);
            PendingIntent notificationIntent = PendingIntent.getActivity(mContext.getApplicationContext(), 1, target2, PendingIntent.FLAG_UPDATE_CURRENT);

            // create notification
            Notification notification = new Notification.Builder(mContext, CHANNEL_ID)
                    .setContentTitle("Notification")
                    .setSmallIcon(Icon.createWithResource(mContext, R.drawable.ic_notification))
                    .setLargeIcon(Icon.createWithResource(mContext, R.drawable.ic_notification))
                    .setCategory(Notification.CATEGORY_MESSAGE)
                    .setStyle(style)
                    .setBubbleMetadata(bubbleMetadata)
                    .addPerson(person)
                    .setShowWhen(true)
                    .setContentIntent(notificationIntent)
                    .build();

            if (notificationManager != null) {
                notificationManager.notify(0, notification);
            }

        }
1 Answers
Related