简体   繁体   中英

How to customize push notification icon?

I am using ParsePush to send notifications to my Android users. I want to customize the notification icon that appears in the action bar.

Currently the app launcher icon is being displayed. But I want to change that and use a different icon for notifications.

这是使用重载函数解决的

setDefaultPushCallback(Context context, Class<? extends Activity> cls, int icon)

尝试这个..

NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder( context).setSmallIcon(@android:drawable/btn_star) 
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());

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