Getting Detail/Expanded Text from an Android Notification?

后端 未结 4 1141
北荒
北荒 2021-01-06 07:55

I\'ve implemented a notification listener to look out for a Gmail notification.

I want to collect the expanded text (bigtext) from the notification as shown in the n

4条回答
  •  盖世英雄少女心
    2021-01-06 08:11

    I found a shorter way of accessing the expanded notification. This works in API 24.

    If you are getting null while accessing getCharSequence("android.textLines"), this is because it actually returns an array of CharSequence as rightly pointed out by Puneet above. So rather access them like this:

    if (extras.getCharSequenceArray("android.textLines") != null)
      text = Arrays.toString(extras.getCharSequenceArray("android.textLines"));
    

提交回复
热议问题