android - How cancel notification with own id? -


i have service download file internet , show progress on notification panel. when download finish notification cancel. have problem when closed app , remove ram (but time service work , download , show on notification. mean there no problem downloading). when download finished notification doesn't cancel. problem? if don't close app notification cancel , lost notification panel. code change progress on notification panel:

 void progresschange(int progress, int id, string nameofmusic,notificationmanager nm) {      if (lastupdate != progress) {         lastupdate = progress;         // not.contentview.setprogressbar(r.id.status_progress,         // 100,integer.valueof(progress[0]), false);         // inform progress bar of updates in progress         // nm.notify(42, not);          log.e("id",id+"");         if (progress < 100) {             mbuilder.setprogress(99, integer.valueof(progress), false)                     .setcontentinfo(progress + "%");             nm.notify(id, mbuilder.build());             startforeground(id, mbuilder.build());               intent = new intent("com.russian.apps.tabactivity").putextra(                     mystring.progress, progress);             this.sendbroadcast(i);         } else {              log.e("id_can",id+"");             //stopself(id);             nm.cancel(id);               log.e("downloaded",nameofmusic);             getnewbuilderforcompleteddownload(id,nameofmusic);             // startforeground(1, mbuilder.build());          }      }  } 


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -