簡體   English   中英

如何自定義推送通知圖標?

[英]How to customize push notification icon?

我正在使用ParsePush向我的Android用戶發送通知。 我想自定義出現在操作欄中的通知圖標。

當前正在顯示應用啟動器圖標。 但是我想更改它,並使用其他圖標進行通知。

這是使用重載函數解決的

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());

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM