简体   繁体   中英

Why is android status bar notification icon not showing up?

I can see the notification of my app when I pull down the status bar, but no icon is showing up. By icon I mean the small white icons like the wifi icon. I have used Android Asset Studio to generate the icons I am using. This is the code:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        String chanel_id = "3000";
        CharSequence name = "Channel";
        String description = "Disc";
        int importance = NotificationManager.IMPORTANCE_HIGH;
        NotificationChannel mChannel = new NotificationChannel(chanel_id, name, importance);
        mChannel.setDescription(description);
        mChannel.enableLights(true);
        mChannel.setLightColor(Color.BLUE);
        notificationManager.createNotificationChannel(mChannel);
        Bitmap bitmap = BitmapFactory.decodeResource(gameActivity.getResources(), R.drawable.ic_kb);
        mBuilder = new Notification.Builder(gameActivity, chanel_id)
                .setSmallIcon(R.drawable.ic_kb)
                .setLargeIcon(bitmap)
                .setContentTitle(title)
                .setContentText(text);
    }

Have you called notificationManager.notify(chanel_id, mBuilder.build()); ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM