android - How to get notification icon of other app? -


i'm using notificationlistenerservice catching notification, of kpbird blog. i'm unable extract icon's drawable. i'm going through this, things not cleared me. please help.

to other application icon, package name of application , use below code. package name notification instance.

string pack= "com.whatsapp" // ex. whatsapp;         context remotepackagecontext = null;          bitmap bmp = null;         try {               remotepackagecontext = getapplicationcontext().createpackagecontext(pack, 0);               drawable icon = remotepackagecontext.getresources().getdrawable(id);               if(icon !=null) {                   bmp = ((bitmapdrawable) icon).getbitmap();             }          } catch (exception e) {               e.printstacktrace();           } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -