Ciao Voglio mostrare tutte le notifiche in un'unica vista .. e voglio aggiornare il numero di notifiche nella barra di stato ... il suo aggiornamento di tutte le informazioni ma mostra il numero sempre 1 .. per favore dimmi come per risolverlo ...Come aggiornare il numero di notifica
@Override
public void onReceive(Context context, Intent intent)
{
//Random randGen = new Random();
//int notify_id = randGen.nextInt();
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Activity.NOTIFICATION_SERVICE);
String title = intent.getStringExtra(TableUtils.KEY_TITLE);
String occasion = intent.getStringExtra(TableUtils.KEY_OCCASION);
Notification notification =
new Notification(R.drawable.icon, "Love Cardz" ,
System.currentTimeMillis());
// notification.vibrate = new long[]{100,250,300,330,390,420,500};
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.number+=1;
Intent intent1 = new Intent(context, ThemesBrowserActivity.class);
PendingIntent activity =
PendingIntent.getActivity(context, 1 , intent1,
PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, occasion, title, activity);
notificationManager.notify(1, notification);
}
abbastanza ridicolo come il framework non ha una semplice chiamata 'getNotifications (int id)' per controllare semplicemente questo ... – clu
Sfortunatamente se l'applicazione è stata uccisa, il contatore si resetta ... Probabilmente dovrebbe salvare in SharedPreference per la persistenza – xnagyg
Come puoi sapere quando è stata aperta la notifica per resettare il contatore ...? – Micro