简体   繁体   English

如何在奥利奥的应用程序图标上显示多个通知计数徽章?

[英]How to display multiple notification count badge on app icon in Oreo?

I'm getting the notification in Oreo version.我收到奥利奥版本的通知。 But i need to show count badge on app icon.但我需要在应用程序图标上显示计数徽章。 I'm not able to display the count badge.我无法显示计数徽章。

Function for getting the notification获取通知的函数

public void sendOnChannel1(View v){
            String title = editTextTitle.getText().toString();
            String messagge = editTextMessage.getText().toString();
            Notification notification = new NotificationCompat.Builder(this,CHANNEL_1_ID)
                    .setSmallIcon(R.drawable.ic_one)
                    .setContentTitle(title)
                    .setContentText(messagge)
                    .setPriority(NotificationCompat.PRIORITY_HIGH)
                    .setCategory(NotificationCompat.CATEGORY_MESSAGE)
                    .setNumber(3)

                    .setBadgeIconType(NotificationCompat.BADGE_ICON_SMALL)
                    .build();


            notificationManager.notify(1, notification);
    }

And this function is for create notification channel此功能用于创建通知通道

private void createNotificationChannels() {
            if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
                try{
                    NotificationChannel channel1=new NotificationChannel(CHANNEL_1_ID, "Channel 1", NotificationManager.IMPORTANCE_HIGH);
                    channel1.setDescription("This is Channel 1");
                    channel1.setShowBadge(true);
                    channel1.canShowBadge();
                    NotificationManager manager=getSystemService(NotificationManager.class);
                    manager.createNotificationChannel(channel1);
                }
                catch (Exception e){
                    e.printStackTrace();
                }

            }
        }

I want to display count badge on app icon.我想在应用程序图标上显示计数徽章。 Please Help请帮忙

Thanks in Advance :)提前致谢 :)

this isn't depend on you... from the DOC :这不取决于你......来自DOC

Sets the number of items this notification represents.设置此通知代表的项目数。 May be displayed as a badge count for Launchers that support badging .可以显示为支持标记的启动器的标记计数。

so if user is using Launcher without badging support he won't get any dot, not mentioning number... personally I'm using (default) Launcher on my device, which supports only dot, no number at all所以如果用户在没有徽章支持的情况下使用 Launcher,他将不会得到任何点,更不用说数字……我个人在我的设备上使用(默认)Launcher,它只支持点,根本不支持数字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Ionic 2 在 Android 应用程序图标中增加徽章计数通知? - How to increase badge count notification in the Android app icon using Ionic 2? 如何在后台在Android应用程序图标上计算推送通知消息徽章 - How to count Push notification message badge on android app icon in background 如何在三星设备中的应用程序图标徽章上推送通知消息计数 - how to push notification message count on app icon badge in samsung devices 如何以编程方式在Android上的应用程序图标上显示推送通知徽章计数? - How to show push notification badge count on app icon in android programmatically? Android App Icon中的通知计数徽章 - Notification Count Badge in Android App Icon 如何在没有显示通知的情况下在奥利奥设置徽章计数? - How to set badge count in Oreo without showing a notification? 在应用程序图标上显示通知红色徽章 - Display Notification red badge along the App Icon 我想在Android中的启动器图标上显示通知计数(徽章) - i want to display notification count (badge)on launcher icon in android 在没有推送通知的情况下更新应用程序图标上的徽章计数 - Update badge count on app icon without push notification Flutter - 推送通知到达时在应用程序图标上显示徽章编号 - Flutter - Display badge number on app icon when push notification arrives
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM