java - Notification Listener does not read all notifications posted -
following simple code read notifications
public void onnotificationposted(statusbarnotification sbn) { string pack = sbn.getpackagename(); bundle extras = sbn.getnotification().extras; string title = (string)extras.getcharsequence("android.title"); string text=""; if (extras.getcharsequence("android.text") != null) { text =(string) extras.getcharsequence("android.text"); log.d("service1",text); } if(text.trim().equals("")) { if (extras.getcharsequencearray("android.textlines") != null) { log.d("service", "in 1st if"); charsequence[] chartext = extras.getcharsequencearray("android.textlines"); if (chartext.length > 0) { text = (string) chartext[chartext.length - 1]; log.d("service2", text); } } } if(text.trim().equals("")) { if (extras.getcharsequence("android.infotext") != null) { log.d("service", "in 2nd if"); text = (string) extras.getcharsequence("android.infotext"); log.d("service2", text); } }
the code works fine white background notifications. however, receive text =null
notifications black background.
i have tried using remote views. but, not read white background notifications
can ?
edit: this screenshot mobile have checked code on api 21 version mobile. totally agree battery doctor, weather notifications appear in grayish background, use remote views , method won't read these notifications.
i receive bbc news
, screenshot captured
, 4 applications updated
notification.
however, notification computer program can read mind
, exercise helps live through first heart..
, receive package name , both title , text null.
Comments
Post a Comment