繁体   English   中英

Android推送通知图标

[英]Android push notification icon

通常,我会在推送通知中使用应用程序的图标。

.setSmallIcon(applicationContext.getApplicationInfo().icon)

如何在另一个推送通知中使用另一个(我自己创建的)自定义图标?

 .setSmallIcon(R.drawable.your_icon)

在此处输入图片说明

NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
        .setContentTitle(notificationTitle)
        .setContentText(notificationMessage)
        .setSmallIcon(R.drawable.YOUR_IMAGE)
        .setContentIntent(resultPendingIntent)
        .setAutoCancel(true)
        .setStyle(bigStyle);

NotificationManager notificationmanager = (NotificationManager)context.getSystemService(context.NOTIFICATION_SERVICE);
notificationmanager.notify(nofy_id, builder.build());

暂无
暂无

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

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