getNotification().extras Bundle object values are null for specific apps

Viewed 228

I've an android app that parses notifications and displays all (most of) the contents in a custom interface.

I get the required data in all cases, but except for Google Pay (Formerly Tez in India) and Google Photos. In case of these apps, all the bundle values give me null, even checked while debugging. This is weird. Checked in the Notification Log hidden in Android Settings menu and it shows the values are present but at API level, I only get the bitmap and some "caption text". Rest all are NULL.

My code looks like below (null checks omitted)

Bundle extras = sbn.getNotification().extras;
content_title = extras.get(Notification.EXTRA_TITLE).toString();
a = extras.get(Notification.EXTRA_BIG_TEXT).toString();
b= extras.get(Notification.EXTRA_TEXT).toString();
c= extras.get(Notification.EXTRA_SUMMARY_TEXT).toString();
icon = (Bitmap) extras.get(Notification.EXTRA_LARGE_ICON);
lines = (CharSequence[]) extras.get(Notification.EXTRA_TEXT_LINES);

I suspect there is some kind of sensitive data protection stuff going on here. But why then only these two apps? Tez maybe a payments app, but why Google Photos? And what is the documentation and reference to such behavior?

0 Answers
Related