Getting Detail/Expanded Text from an Android Notification?

后端 未结 4 1142
北荒
北荒 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:20

    After viewing the above link, I further investigate the bundle (EXTRAS) data. When you debug it and look at the variable, you can find that all information regards the notification are stored in the bundle and you can get the detail by

    notifyBundle.extras.getCharSequence("android.textLines") for multi line notification and

    notifyBundle.extras.getString("android.text") for single line notification.

    For more information, look at the variable in eclipse debugging mode

    Image of variables in bundle for single line notification

    Image of variables in bundle for multi line notification

    Note: The extra bundle only available in API19 (Kitkat). I've never tried in device which lower than API19.

提交回复
热议问题