2013-10-17 23 views
5

Kullanıcının içinde bulunan düğmeyi kullanmadan bildirimi temizlemesine izin vermenin bir yolu var mı? SetAutoCancel'i (false) zaten ayarladım ve tamam, ancak tüm bildirimleri temizleyen bir düğme var ve bildirimi temizlemesini istemiyorum, çünkü bunun kullanıcı için önemli olduğunu ve onu okumalı ve bir eylem seçmesi gerekiyor.Kullanıcının android bildirimini temizlemesine izin verme.

NotificationCompat.Builder builder = new NotificationCompat.Builder(context) 
     .setSmallIcon(R.drawable.icon) 
     .setContentTitle("Sync Failed") 
     .setContentText("Lorem ipsum dolor sit amet") 
     .setStyle(new NotificationCompat.BigTextStyle().bigText("Lorem ipsum dolor sit amet")) 
     .addAction(R.drawable.change, "Change Pass", pChangePass) 
     .addAction(R.drawable.remove, "Ignore", pIgnore) 
     .setAutoCancel(false); 


mNotificationManager.notify(accountUnique, builder.build()); 

cevap

14
.setOngoing(true) 

ihtiyaç da eklenecek!

1

bu gibi son üç satır kodunu değiştirmek için ..

final Notification notification = builder.build(); 
notification.flags = Notification.FLAG_NO_CLEAR; 
mNotificationManager.notify(accountUnique, notification); 
İlgili konular