2017-01-01 12 views
0

私は.setAutoCancel(false) and .setOngoing(true);を試しましたが、スワイプしても通知がクリアされるのはなぜですか?ここに私のコード - 私はよく通知がクリアされるのはなぜですか?

// Add as notification 
     NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
     Notification notif = builder.build();// add flag support 
     notif.flags |= Notification.FLAG_ONGOING_EVENT; 
     notif.flags |= Notification.FLAG_NO_CLEAR; 
     manager.notify(111, builder.build()); 
+0

を試してみてください?アプリを閉じる..? – rafsanahmad007

+0

ステータスバーからスワイプ –

答えて

0

としてのフラグを追加しようとしている

 Notification.Builder builder = new Notification.Builder(this) 
      .setSmallIcon(R.drawable.download) 
      .setContentTitle("Download[ROOT]") 
      // .setContentText("This is a test notification") 
      .setAutoCancel(false).setOngoing(true); 
    Intent notificationIntent = new Intent(this, DownloaderRoot.class); 
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, 
      notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); 
    builder.setContentIntent(contentIntent); 
    // Add as notification 
    NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
    manager.notify(111, builder.build()); 

であるuはそれをスワイプ何を意味しています。この

Notification notif = builder.build(); 
notif.flags |= Notification.FLAG_ONGOING_EVENT; 
manager.notify(111, notif); 
+0

問題の編集をご覧ください –

関連する問題