String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.ic_notification_icon;
android.app.Notification.Builder nbuilder = new Notification.Builder(this);
nbuilder.setContentTitle(getString(R.string.notifcation_title,mProfile.mName));
nbuilder.setContentText(msg);
nbuilder.setOnlyAlertOnce(true);
nbuilder.setOngoing(true);
nbuilder.setSmallIcon(icon,level.level);
如何隱藏或完全刪除smallIcon?我試圖不使用nbuilder.setSmallIcon,但結果是,根本沒有顯示通知!Android Notification.Builder:顯示沒有圖標的通知
只有這樣,我知道的是使用透明圖像的圖標,然後設置通知的順序,以便您的最後(最右邊)使用戶看起來好像沒有圖標。 – FoamyGuy 2013-04-23 13:30:22
這是爲什麼在用戶的興趣? – CommonsWare 2013-04-23 13:34:00
@CommonsWare:一個用例:運行在隱形中的通信應用程序確實希望用戶知道消息何時到達,但不想顯示應用程序圖標或任何圖標以使其他人看不到。 – 2017-08-07 11:58:49