'Android NotificationListenerService: How to check if the notification detected was created from Work Profile?

Let's say there is a work-profile setup in the phone, which has some apps (Like Outlook, Webex, MS Teams, etc.) installed. Also, we have outlook installed in the personal profile too. If work Outlook receives a mail, an app working in the personal profile is able to receive its notification's details in a NotificationListenerService. My doubt is, how can we filter the incoming notification data to only work on the notifications being generated from the Work-Profile Apps (Like the work Outlook, Webex, MS Teams, etc.)?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source