[英]Hide notification icon from status bar android
我在從服務通知中隱藏狀態欄中的通知圖標時遇到問題。
這是我所做的:我將通知優先級設置為 min,讓它們靜音
NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"test");
builder.setSmallIcon(R.drawable.notif);
builder.setContentTitle(getString(R.string.app_name));
builder.setContentText(profile.mName);
builder.setContentIntent(pendingIntent);
builder.setNotificationSilent();
builder.setPriority(NotificationCompat.PRIORITY_MIN);
在頻道中,我也將優先級設置為 min 但我仍然在狀態欄中看到通知圖標
NotificationChannel channel = new NotificationChannel(id, getApplicationContext().getString(R.string.app_name), NotificationManager.IMPORTANCE_MIN);
channel.setSound(null, null);
channel.setImportance(NotificationManager.IMPORTANCE_MIN);
channel.enableVibration(false);
好的,我可以理解您首先使用通知渠道嘗試優先級或重要性高的事情。 根據文檔,一旦創建了通知通道,就無法通過更改代碼來更新它。 如果您想像在代碼中所做的那樣應用優先級或重要性低等新更改,那么您需要clear app cache
或uninstall app
,然后重新安裝。這會將新的通知渠道更改應用於您的應用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.