android - NotificationListenerService - get whatsapp messages text for -4.4 -


i'm building application working on same idea 1 -

https://play.google.com/store/apps/details?id=com.stallware.dashdow.whatsapp.lite

  • when whatsapp notification arrive, notification text - example, in application when notification arrive, nlserivce create bubble contact name , content,

my question how can data? there null in "sbn.getnotification().tickertext", found solution 4.4+, :

title = (string) sbn.getnotification().extras.getcharsequence(notification.extra_title); text = (string) sbn.getnotification().extras.getcharsequence(notification.extra_text); 

gives me information need, 'extras' requires api 19 + (kitkat..), need information older versions 4.3..

what missing? other way parse data?

  • another question (same idea..) how can use accessability service android 4.0 - 4.3? need know when notification removed notification bar , couldnt understand how can know when using as..

from dashdow app information -

"for devices android 4.3 or higher use notification access service have activate. devices 4.0 or higher have enable accessability service in system."

any idea? in advance

try this:

charsequence[] lines =  extras.getcharsequencearray(notification.extra_text_lines); if(lines != null && lines.length > 0) {    stringbuilder sb = new stringbuilder();    (charsequence msg : lines)       if (!textutils.isempty(msg)) {          sb.append(msg.tostring());          sb.append('\n');       }    return sb.tostring().trim(); } charsequence chars =  extras.getcharsequence(notification.extra_big_text); if(!textutils.isempty(chars))    return chars.tostring(); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -